AdomdConnection.CubeClosing 事件
在多维数据集开始关闭时、但在实际关闭多维数据集之前发生。
命名空间: Microsoft.AnalysisServices.AdomdServer
程序集: msmgdsrv(在 msmgdsrv.dll 中)
语法
声明
Public Event CubeClosing As EventHandler
用法
Dim instance As AdomdConnection
Dim handler As EventHandler
AddHandler instance.CubeClosing, handler
public event EventHandler CubeClosing
public:
event EventHandler^ CubeClosing {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
member CubeClosing : IEvent<EventHandler,
EventArgs>
JScript 支持使用事件,但不支持声明新事件。
注释
以下代码是 Analysis Services 个性化扩展插件 (ASPE) 的一部分,它说明如何使用 CubeClosing 和 CubeOpened 事件。
备注
还可以从 Microsoft SQL Server Samples and Community Projects网站下载以下示例代码。
示例
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AnalysisServices.AdomdServer;
namespace ISV_1.ASClientExtensions
{
public class SessionMgr
{
public SessionMgr()
{
Context.CurrentConnection.CubeOpened += new EventHandler(CubeOpened);
Context.CurrentConnection.CubeClosing += new EventHandler(CubeClosing);
}
~SessionMgr()
{
}
public void CubeOpened(object sender, EventArgs e)
{
String username = Context.CurrentConnection.User.Name;
username = username.Substring(username.IndexOf('\\')+1).ToLowerInvariant();
//Verify and set user experience for opened cube
// that is define calculated members according to user profile
AuthoringAndManagement.DefineMembers(Context.CurrentDatabaseName, Context.CurrentCube.Name, username);
// that is define KPIs according to user profile.
AuthoringAndManagement.DefineKPIs(Context.CurrentDatabaseName, Context.CurrentCube.Name, username);
// that is define sets according to user profile.
AuthoringAndManagement.DefineSets(Context.CurrentDatabaseName, Context.CurrentCube.Name, username);
}
public void CubeClosing(object sender, EventArgs e)
{
//Close and discard any object that requires clean-up
}
}
}