Databases Reference
In-Depth Information
Working with Metadata That Is Not Presented in the Form of Objects
Analysis Services keeps a lot of metadata about the model, but not all of this metadata is
represented by objects of the ADOMD.NET object model. To get access to this kind of
metadata information, you can use the AdomdConnection.GetSchemaDataSet .
This method is similar to the GetSchema method in OLE DB or OledbClient.GetOLEDB
SchemaDataTable : It allows client application to retrieve any schema rowset or Discover
supported by the server. ADOMD.NET provides three overloads for the GetSchemaDataSet
method:
public DataSet GetSchemaDataSet(Guid schema, object[] restrictions)
public DataSet GetSchemaDataSet(String schemaName, AdomdRestrictionCollection
restrictions)
public DataSet GetSchemaDataSet(String schemaName, String schemaNamespace,
AdomdRestrictionCollection restrictions)
The first overload is modeled after the GetSchema method of OLE DB and allows the caller
to pass the GUID of the schema with an array of restrictions. The second one is modeled
after the Discover method of XML/A, and takes the name of the schema rowset to be
retrieved; it also accepts a collection of restrictions. Each restriction is identified by the
name, so there is no need to preserve the order of the restrictions in the collection.
Future versions of Analysis Services might extend the list of supported schema rowsets or
XML/A Discover requests. To support the compatibility between the new server and old
client, those schema rowsets probably will be implemented in the new namespace. The
last overload of the GetSchemaDataSet method is designed to enable the client application
to use current version of ADOMD.NET to work with future versions of the server. It allows
a client application to pass not only the name of the request, but also the namespace in
which this request was implemented. Let's look at an example (see Listing 33.10) that
demonstrates how to retrieve a list of Action objects (actions are not represented by the
ADOMD.NET object) using GetSchemaDataSet .
LISTING 33.10
Iterating Actions Using the GetSchemaDataSet Method
//Open a connection to the server.
AdomdConnection con = new AdomdConnection();
con.ConnectionString = “Datasource=localhost; Initial Catalog=Foodmart 2008;
Safety Options=1”;
con.Open();
//Create a collection of restrictions for GetSchemaDataSet.
AdomdRestrictionCollection restrictions = new AdomdRestrictionCollection();
Search WWH ::




Custom Search