Interfaces (DSO)
[!NOTA]
Questa caratteristica verrà rimossa a partire dalla prossima versione di Microsoft SQL Server. Non utilizzare questa caratteristica in un nuovo progetto di sviluppo e modificare non appena possibile le applicazioni in cui è attualmente implementata.
There are a number of interfaces in Decision Support Objects (DSO). Objects that have similar functionality implement a common interface.
For example, databases, cubes, partitions, and aggregations implement the MDStore interface. An MDStore object is a container of multidimensional data. Databases contain cubes of related information, cubes contain partitions that store data, and aggregations are precalculated summaries of data associated with partitions. MDStore objects have similar structures. They contain collections of dimensions that categorize the data, the data sources that specify which relational database management system (RDBMS) contains fact and dimension tables, the roles that define the security permissions, and so on.
Given a reference to an MDStore interface or any other DSO interface, you can determine which type of the object you are dealing with by examining the ClassType property. The objects that implement the MDStore interface can have the following class types: clsDatabase, clsCube, clsPartition, and clsAggregation. Throughout the programmer's reference, DSO objects are identified using the notational prefix "cls." The DSO ClassTypes enumeration contains the complete list of all DSO class types.
Not all objects that implement a common interface implement the interface in the same way. Some objects do not implement all of the interface properties, methods, and collections. For example, database objects (clsDatabase) implement the BeginTrans method of the MDStore interface, but cube objects (clsCube) do not. Some objects restrict access to certain properties so that they become read-only rather than read/write. If you attempt to access a property or invoke a method that is not implemented, DSO raises an error.
DSO exposes the Command, Dimension, Level, MDStore, Measure, and Role interfaces.
The following table lists the DSO interfaces and the types of objects that implement them.
Interface |
Description |
Implemented by |
---|---|---|
The Command interfaceexposes functionality for defining and managing Multidimensional Expressions (MDX) statements to be executed on the Analysis server. |
||
The Dimension interface defines the properties, methods, and collections that you can use to manipulate different types of dimensions: database dimensions, cube dimensions, partition dimensions, and aggregation dimensions. |
||
The Level interface defines objects that specify the dimension hierarchy. |
||
Objects that implement the MDStore interface are those that contain dimensions: databases, cubes, partitions, and aggregations. |
||
Objects that implement the Measure interface describe the values stored in cubes, partitions, and aggregations. |
||
Objects that implement the Role interface contain access permissions on databases, cubes, and data mining models. |
Some DSO objects do not implement a common interface. You access these objects by using their default interface: clsServer, clsDataSource, clsMiningModel, clsColumn, clsCubeAnalyzer, clsPartitionAnalyzer, and clsMemberProperty.
Osservazioni
The DSO type library exposes several object classes, such as Cube, Database, Partition, CubeDimension, and so on. These objects are reserved for future use and are not intended to be used in DSO applications. You should use the named interfaces instead. For example, use the following code to create a new object of ClassType clsDatabase (a database object implements the MDStore interface):
'Assume an object (dsoServer) of ClassType clsServer exists.
'Add database object to server's MDStores collection.
Dim dsoDB As MDStore ' Declare the object by the interface.
Set dsoDB = dsoServer.MDStores.AddNew("MyDB")
Always use the appropriate interface for the object. For example, major objects typically use the MDStore interface as their appropriate interface. The following code example shows the appropriate interface to use for cube objects:
Private dsoCube As DSO.Cube ' INCORRECT - DO NOT USE.
Private dsoCube As DSO.MDStore ' CORRECT
The only exceptions to this rule are Database objects. If your client application needs to trap database events, the internal interface of the object should be used instead of the MDStore interface, as shown in the following code example:
Public dsoDB as DSO.MDStore ' Use this statement if you do not need to trap events.
Public WithEvents dsoDB as DSO.Database ' Use this statement if you need to trap events.