The MDStore interface is implemented by objects in Microsoft® SQL Server™ OLAP Services Decision Support Objects (DSO) that contain multidimensional data. These are objects are databases, cubes, partitions, and aggregations. They are identified by the value of their ClassType property, which is one of clsDatabase, clsCube, clsPartition, or clsAggregation.
The relationships among these objects are maintained through parent-child linkages using the MDStores collections of each of these objects and the server object. The MDStores collection of a server object contains database objects. Database objects contain cube objects. Cubes contain partitions, and partitions contain aggregations. Together, the MDStore interface and the MDStores collections establish and maintain the hierarchy that defines the structure of OLAP data.
The MDStore interface provides collections, methods, and properties to manipulate these objects, their contained objects, and data. For an overview of database, cube, partition, and aggregation objects and how they relate to each other, see About Decision Support Objects.
The four objects that implement the MDStore interface do not necessarily implement all of the MDStore collections, properties, and methods. Additionally, some MDStore properties and collections may be restricted to read-only access by some objects. For example, an object of ClassType clsDatabase allows read and write access to its DataSources collection whereas access to the DataSources collection of an object of ClassType clsAggregation object is read-only.
clsAggregation | clsDatabase |
clsCube | clsPartition |
You create objects that implement the MDStore interface by declaring a variable as an MDStore data type and then creating an instance of the object and adding it to the MDStores collection of another object. The AddNew method of the MDStores collection creates the instance, sets the object’s name to the name you provide, adds the object to the collection, and sets its parent property to reference the owner of the collection. At the same time, the new object’s ClassType is automatically initialized to the appropriate value depending on the object’s parent. For example, if you use the AddNew method to create an object in a cube’s MDStores collection, the new object’s ClassType will be set to clsPartition.
For more information about DSO, see About Decision Support Objects and Interfaces.
The following DSO code creates a server object, connects this object to an OLAP server, and creates database, cube, partition, and aggregation objects in the correct hierarchical structure under the server object:
Dim dsoServer As DSO.Server
' Create a Server object and connect to an OLAP server
Set dsoServer = New DSO.Server
dsoServer.Connect("LocalHost")
' LocalHost causes connection to the OLAP server running
' the same computer as the DSO application
' Create and add a database to the server's MDStores collection
Dim dsoDB As DSO.MDStore
Set dsoDB = dsoServer.MDStores.AddNew("MyDatabase")
'... additional code to set other database object properties
' Create and add a cube to the database’s MDStores collection
Dim dsoCube As DSO.MDStore
dsoCube = dsoDB.MDStores.AddNew("MyCube")
'... additional code to set other cube properties
' Create and add a partition to the cube's MDStores collection
Dim dsoPart As DSO.Partition
Set dsoPart = dsoCube.MDStores.AddNew("MyPartition")
'... additional code to set other partition properties
' Create and add an aggregation to the partition's MDStores collection
Dim dsoAgg As DSO.MDStore
Set dsoAgg = dsoPart.MDStores.AddNew("MyAggregation")
'... additional code to set other aggregation properties