Working With the ADOMD.NET Object Model

New: 5 December 2005

ADOMD.NET provides an object model for viewing the cubes and subordinate objects contained by an analytical data source. However, not all metadata for a given analytical data source is available through the object model. The object model provides access to only the information that is most useful for a client application to display in order to allow a user to interactively construct commands. Because of the reduced complexity of the metadata to present, the ADOMD.NET object model is easier to use.

In the ADOMD.NET object model, the AdomdConnection object provides access to information on the online analytical processing (OLAP) cubes and mining models defined on an analytical data source, and related objects such as dimensions, named sets, and mining algorithms.

Each AdomdConnection object has a collection of CubeDef objects that represent the cubes available to the user or application. The CubeDef object exposes information about the cube, as well as various objects related to the cube, such as dimensions, key performance indicators, measures, named sets, and so on.

Whenever possible, you should use the CubeDef object to represent metadata in client applications designed to support multiple OLAP servers, or for general metadata display and access purposes.

For provider specific metadata, or for detailed metadata display and access, use schema rowsets to retrieve metadata. For more information, see Working With Schema Rowsets in ADOMD.NET.

The following example uses the CubeDef object to retrieve the visible cubes and their dimensions from the local server:

private string RetrieveCubesAndDimensions()
    System.Text.StringBuilder result = new System.Text.StringBuilder();

    //Connect to the local server
    using (AdomdConnection conn = new AdomdConnection("Data Source=localhost;"))

        //Loop through every cube
        foreach (CubeDef cube in conn.Cubes)
            //Skip hidden cubes.
            if (cube.Name.StartsWith("$"))

            //Write the cube name

            //Write out all dimensions, indented by a tab.
            foreach (Dimension dim in cube.Dimensions)

        //Close the connection

    //Return the results
    return result.ToString();

Each AdomdConnection object has several collections that provide information about the data mining capabilities of the data source:

To determine how to query against a mining model on the server, iterate through the Columns collection. Each MiningModelColumn object exposes the following characteristics:

  • Whether the object is an input column (IsInput).
  • Whether the object is a prediction column (IsPredictable).
  • The values associated with a discrete column (Values)
  • The type of data in the column (Type).

Community Additions