Partager via


Event Constructor (NSApplication, String)

Creates and initializes an instance of the Event class.

Espace de noms: Microsoft.SqlServer.NotificationServices
Assembly: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

Syntaxe

'Déclaration
Public Sub New ( _
    nsApplication As NSApplication, _
    eventClassName As String _
)
public Event (
    NSApplication nsApplication,
    string eventClassName
)
public:
Event (
    NSApplication^ nsApplication, 
    String^ eventClassName
)
public Event (
    NSApplication nsApplication, 
    String eventClassName
)
public function Event (
    nsApplication : NSApplication, 
    eventClassName : String
)

Paramètres

  • nsApplication
    An NSApplication that represents the Notification Services application for the event.
  • eventClassName
    A String containing the name of the event class of the Event.

Notes

It is possible to construct an Event without initializing it with an NSApplication. In this case, the event class is not verified, and event field names must be hard-coded. This can be useful in cases where you would like to use an Event in an application that does not have a direct connection to a Notification Services server, for example in a disconnected Message Queuing (also known as MSMQ) scenario. For more information about using an Event in this way, see Utilisation de l'API d'envoi d'événement managé.

Exemple

The following examples show how to create and initialize an Event in managed code.

These examples use the Microsoft.SqlServer.NotificationServices namespace.

Dim instanceName As String = "MyInstanceName"
Dim applicationName As String = "MyApplicationName"
Dim eventClassName As String = "MyEventClassName"

'Create an NSInstance object.
Dim myInstance As New NSInstance(instanceName)

'Create an NSApplication object.
Dim myApplication As New NSApplication(myInstance, applicationName)

'Create an Event object.
Dim myEvent As New Microsoft.SqlServer.NotificationServices.Event( _
    myApplication, eventClassName)
string instanceName = "MyInstanceName";
string applicationName = "MyApplicationName";
string eventClassName = "MyEventClassName";

//Create an NSInstance object.
NSInstance myInstance = new NSInstance(instanceName);

//Create an NSApplication object.
NSApplication myApplication = 
    new NSApplication(myInstance, applicationName);

//Create an Event object.
Event myEvent = new Event(myApplication, eventClassName);

Plateformes

Plateformes de développement

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Plateformes cibles

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Voir aussi

Référence

Event Class
Event Members
Microsoft.SqlServer.NotificationServices Namespace