共用方式為


Interfaces (DSO)

[!附註]

  下一版的 Microsoft SQL Server 將不再提供此功能。請勿在新的開發工作中使用此功能,並且儘速修改使用此功能的應用程式。

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

Command

The Command interfaceexposes functionality for defining and managing Multidimensional Expressions (MDX) statements to be executed on the Analysis server.

clsDatabaseCommand

clsCubeCommand

clsRoleCommand

Dimension

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.

clsDatabaseDimension

clsCubeDimension

clsPartitionDimension

clsAggregationDimension

Level

The Level interface defines objects that specify the dimension hierarchy.

clsDatabaseLevel

clsCubeLevel

clsPartitionLevel

clsAggregationLevel

MDStore

Objects that implement the MDStore interface are those that contain dimensions: databases, cubes, partitions, and aggregations.

clsDatabase

clsCube

clsPartition

clsAggregation

Measure

Objects that implement the Measure interface describe the values stored in cubes, partitions, and aggregations.

clsCubeMeasure

clsPartitionMeasure

clsAggregationMeasure

Role

Objects that implement the Role interface contain access permissions on databases, cubes, and data mining models.

clsDatabaseRole

clsCubeRole

clsMiningModelRole

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.

備註

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.