Analysis Management Object对象模型

SQL Server 2005中,Analysis Management ObjectAMO)是一种全新的编程对象模型。开发人员可以使用AMO创建维度,立方体,分区等Analysis Services对象。本文主要介绍AMO的对象模型,对象模型中的类,以及类中的属性和方法。
[Quick Tips]
    当你使用AMO对象进行编程的时候,如果需要处理数据库中的所有的对象,可以调用Database对象的Process()方法,并将ProcessType的属性设置为ProcessFull。如果仅仅需要处理一个单独的对象(比如维度),可以调用Process()方法,例如objDimension.Process()而不需要设置维度对象的Process属性。
简介
    继SQL Server 2000ADOMD后,AMO成为了SQL Server 2005的强大开发工具;AMO对象模型基于XML/A协议。XML/A是依据于XML协议的一个简单对象访问协议,主要用于客户端应用程序与Analysis Services进行数据交互。AMO使用XML/AAnalysis Services实现连接。AMO提交的所有操作命令都将转换成XML/A的格式。开发人员可以使用AMO自动地创建和处理Analysis Services对象模型。AMO也取代了在SQL Server 2000中使用的决策支持对象(DSO)。虽然在SQL Server 2005中同时支持DSOAMO,但是微软已经明确表示,在SQL Server 2005的下一个版本中,将全面废弃DSO,SQL Server 2005中的DSO也仅仅是为了能够将SQL Server2000种的数据迁移到SQL Server 2005中。因此,如果你正在做一个托管或者非托管的应用程序,或者你想要使用Analysis Services 2005的新特性,那么你就应该毫不犹豫地使用AMO
AMO对象模型
      AMO提供了对Analysis Services 2005对象进行管理的完整的类库,AMO的所有的类位于Microsoft.Analysis命名空间下。下图是AMO对象模型的一个高层次的视图

 

The Server Class

  • Is the main class in the AMO
  • Exposes the server functionality of Analysis Services
  • Contains a collection of Database objects

Property/Method

Description

Connected

Checks the current connection state (whether it's open or closed) and returns a Boolean value of true or false

Name

Retrieves the Analysis Services name

ConnectionString

Retrieves the server connection information

Connect()

Connects to Analysis Services

Disconnect()

Disconnects from Analysis Services

Add()

Adds a database to Analysis Services

Restore()

Restores a database to Analysis Services from a backup

Reconnect()

Reconnects to Analysis Services

The Database Class

  • Provides the functionality of a Database in Analysis Services
  • Contains a collection of DataSource , DataSourceView , Dimension , and Cube objects

Property/Method

Description

Name

Retrieves the Database name

Backup()

Backs up a Database to a specific location

Drop()

Drops a Database

Process()

Processes a Database and all the objects contained in the Database

Update()

Saves the Database to Analysis Services

Add()

Adds a DataSource , DataSourceView , Dimension , or Cube object to the database

The RelationalDataSource Class

  • Represents the DataSource object in Analysis Services
  • Inherits properties and methods from the DataSource class of the AMO
  • Should be used instead of the DataSource class when creating a DataSource object

Property/Method

Description

ConnectionString

Sets the data source information

Update()

Saves the DataSource object to Analysis Services

The DataSourceView Class

  • Represents the DataSourceView object in Analysis Services

Property/Method

Description

DataSourceID

Associates a DataSource with the DataSourceView ; also retrieves the current DataSource associated with the DataSourceView

Schema

Assigns a table schema to the DataSourceView

Update()

Saves the DataSourceView to Analysis Services

The Dimension Class

  • Represents the Dimension object in Analysis Services
  • Contains a collection of Attribute and Hierarchy objects

Property/Method

Description

Source

Sets the Dimension 's source

ProcessingMode

Sets the processing mode of the Dimension ; possible values are Regular and LazyAggregation

StorageMode

Sets the storage mode of the Dimension ; possible values are ROLAP and MOLAP

WriteEnabled

Write-enables a Dimension

Update()

Saves a Dimension to Analysis Services

Process()

Processes a Dimension

The Hierarchy Class

  • Represents the Hierarchy object in Analysis Services
  • Is associated with the Dimension

Property/Method

Description

Name

Sets the name of the Hierarchy

AllMemberName

Sets the name of the AllMemberName in the Hierarchy

Add()

Adds a Level to the Hierarchy

The Level Class

  • Represents the Level object in Analysis Services
  • Is associated with a Hierarchy

Property/Method

Description

Name

Sets the name of the Level

SourceAttribute

Sets the source Attribute for the Level

The DimensionAttribute Class

  • Represents the Attribute object in Analysis Services
  • Is used as the source for the Level in the Hierarchy , or as a MemberProperty in the Level

Property/Method

Description

KeyColumns

Sets the key column for an Attribute

NameColumn

Sets the name column for an Attribute

Usage

Sets the Attribute usage. Possible Attribute values are Regular , Key , Parent , and Account

DefaultMember

Sets the DefaultMember in the Attribute

Add()

Adds a MemberProperty

The AttributeRelationships Class

  • Represents the MemberProperty object in Analysis Services

Property/Method

Description

Name

Retrieves the MemberProperty name

Visible

Retrieves the visibility of the MemberProperty (whether it's visible to the browser/client application)

AttributeID

Retrieves the AttributeID that is used by the MemberProperty

Parent

Retrieves the Level that contains the MemberProperty

The Cube Class

  • Represents the Cube object in Analysis Services
  • Contains a collection of MeasureGroup objects

Property/Method

Description

StorageMode

Sets the default storage mode of the Cube ; possible values are ROLAP , HOLAP , and MOLAP

ProcessingMode

Sets the default processing mode of the Cube ; possible values are Regular and LazyAggregation

Source

Sets the source of the Cube

Process()

Processes the Cube and all objects contained in the Cube

Add()

Adds a MeasureGroup and MDX script into the Cube

Update()

Saves the Cube and all the objects contained in the Cube to Analysis Services

The MeasureGroup Class

  • Represents the MeasureGroup object in Analysis Services
  • Contains a collection of Measure and Partition objects

Property/Method

Description

StorageMode

Sets the storage mode of the MeasureGroup ; the storage mode can be ROLAP , HOLAP , or MOLAP

Add()

Adds a Dimension , a Measure , and a Partition into the MeasureGroup

The Measure Class

  • Represents the Measure object in Analysis Services

Property/Method

Description

Source

Sets the Measure class's source

FormatString

Formats the Measure

Visible

Sets the visibility of the Measure ; if set to visible, the Cube browser and client application will be able to view the Measure

DisplayFolder

Creates a folder to group and categorize the Measure

The Partition Class

  • Represents the Partition object in Analysis Services

Property/Method

Description

Source

Sets the source of the Partition

ProcessingMode

Defines the processing mode of the Partition ; possible values are Regular and LazyAggregation

StorageMode

Defines the Partition class's storage mode; the storage modes can be ROLAP , HOLAP , or MOLAP

Slice

Specifies the data slice or portion of data contained in the Partition ; is used when creating two or more Partition classes

 

posted @ 2007-03-15 13:25  随风而逝  阅读(869)  评论(0编辑  收藏  举报