Поделиться через


Event Constructor (NSApplication, String)

Creates and initializes an instance of the Event class.

Пространство имен: Microsoft.SqlServer.NotificationServices
Сборка: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

Синтаксис

'Декларация
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
)

Параметры

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

Замечания

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 Использование API-интерфейса передачи управляемого события.

Пример

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

Платформы

Платформы разработки

Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.

Целевые платформы

Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.

См. также

Справочник

Event Class
Event Members
Microsoft.SqlServer.NotificationServices Namespace