Событие CubeClosing
Occurs when the cube starts to close, but before the cube is actually closed.
Пространство имен: 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 поддерживает использование событий, но не объявление новых.
Замечания
The following code is part of the Analysis Services Personalization Extensions (ASPE) and shows how to use CubeClosing and CubeOpened events.
Примечание |
---|
The following sample code can also be downloaded from the Microsoft SQL Server Samples and Community Projects Web site. For more information about how to download and install samples, see Installing SQL Server Samples and Sample Databases in SQL Server Books Online. |
Примеры
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
}
}
}