Zdarzenie Server.SessionClosing
Występuje, gdy sesja między serwerem, którym jest uruchomione wystąpienie Usługi Analysis Services i uruchamia klient zamknąć, ale przed sesja jest ostatecznie zamknięty.
Przestrzeń nazw: Microsoft.AnalysisServices.AdomdServer
Zestaw: msmgdsrv (w msmgdsrv.dll)
Składnia
'Deklaracja
Public Event SessionClosing As EventHandler
'Użycie
Dim instance As Server
Dim handler As EventHandler
AddHandler instance.SessionClosing, handler
public event EventHandler SessionClosing
public:
event EventHandler^ SessionClosing {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
member SessionClosing : IEvent<EventHandler,
EventArgs>
Język JScript obsługuje używanie zdarzeń, ale nie obsługuje deklarowania nowych.
Uwagi
Poniższy kod jest częścią Analysis Services personalizacji rozszerzenia (ASPE) i przedstawiono sposób użycia SessionClosing i SessionOpened zdarzenia.
Ostrzeżenie
Następujący przykładowy kod może być również pobrany z Microsoft SQL Server Samples and Community Projects witryna sieci Web.Aby uzyskać więcej informacji dotyczących sposobu pobierania i instalowania próbek, zobacz Instalowanie SQL Server próbki i przykładowe bazy danych w SQL Server Books Online.
Przykłady
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AnalysisServices.AdomdServer;
namespace ISV_1.ASClientExtensions
{
[PlugInAttribute]
public class ASClientExtensions
{
public ASClientExtensions()
{
Context.Server.SessionOpened += new EventHandler(this.SessionOpened);
Context.Server.SessionClosing += new EventHandler(this.SessionClosing);
//Verify and set environment for ClientExtensions.
AuthoringAndManagement environment = new AuthoringAndManagement();
}
~ASClientExtensions()
{
}
public void SessionOpened(object sender, EventArgs e)
{
// This will subscribe to the events.
SessionMgr session = new SessionMgr();
}
public void SessionClosing(object sender, EventArgs e)
{
}
}
}