Friday, February 24, 2012

AMO vs. ADOMD

I use AMO to programmatically create a complete database with datasource, datasourceview, dimensions, and cubes. I also have a webservice that uses ADOMD.NET to retrieve metadata about those objects (for security purposes and also for .NET 1.1 applications). However, I notice that using ADOMD's GetSchemaDataSet only return certain metadata. For example, for a dimension, it doesn't return the DimensionID or other properties I am able to set with AMO. I want to use ADOMD.NET because it returns the metadata in XML format already. With AMO, I have to serialize the dimension object. Is there any other way to retrieve additional metadata for AMO objects?

You can use "DISCOVER_XML_METADATA" with GetSchemaDataSet (this is the discover type AMO is using to get all the metadata for objects).

<RequestType>DISCOVER_XML_METADATA</RequestType>
<Restrictions>
<RestrictionList>
<DatabaseID>DataWarehouse Project1</DatabaseID>
<DataSourceViewID>Budget 1</DataSourceViewID>
<ObjectExpansion>ObjectProperties</ObjectExpansion> // can also be ExpandFull, ExpandObject or ReferenceOnly
</RestrictionList>
</Restrictions>

Adrian Dumitrascu

|||Thanks Adrian!! That's exactly what I am looking for. I assume I can just deserialize the xml to get the AMO object back. My only concern is that AMO objects are pretty powerful and it's possible for the client to modify the cube structure. I may create my own readonly wrapper classes for each AMO object or inherit the AMO objects and override the update/process methods.|||

> I assume I can just deserialize the xml to get the AMO object back.

Yes, there is the Utils class with Serialize and Deserialize methods for this.

> I may create my own readonly wrapper classes for each AMO object or inherit the AMO objects and override the update/process methods.

You will need to create wrapper classes because most of the AMO classes are sealed. But what kind of additions/changes you want for the Update and Process ? Maybe they have some flags/parameters that would help.

Adrian Dumitrascu

|||

Adrian Dumitrascu wrote:

You will need to create wrapper classes because most of the AMO classes are sealed. But what kind of additions/changes you want for the Update and Process ? Maybe they have some flags/parameters that would help.

Here's my scenario. I am deploying a click-once application to the end-user that allows them to query the cube by choosing a measure and 2 dimensions. Then they can save their configurations back to the server so next time they can open the configuration and view/edit them. I have a webservice that the click-once app uses to retrieve metadata about the cube. I was going to have the click-once app reference Microsoft.AnalysisServices dll so I can easily deserialize the XML to actual AMO objects I can use. However, since the click-once shouldn't need a live connection to the Analysis Server or make any changes to it, I don't really want to use AMO objects at all. Kind of an overkill. I was going to just create some simple classes that will parse the XML for the properties I want. The bad part is that I will have to create a class for all the AMO objects I want to use...not hard at all but just tedious.

No comments:

Post a Comment