Partilhar via


Event Constructor (NSApplication, String)

Creates and initializes an instance of the Event class.

Namespace: Microsoft.SqlServer.NotificationServices
Assembly: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

Syntax

'Declaration
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
)

Parameters

  • 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.

Remarks

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 Using the Managed Event Submission API.

Example

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);

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

Event Class
Event Members
Microsoft.SqlServer.NotificationServices Namespace