다음을 통해 공유


EventCollector.Write Method

Writes one event to the EventCollector.

네임스페이스: Microsoft.SqlServer.NotificationServices
어셈블리: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

구문

‘선언
Public Sub Write ( _
    eventData As Event _
)
public void Write (
    Event eventData
)
public:
virtual void Write (
    Event^ eventData
) sealed
public final void Write (
    Event eventData
)
public final function Write (
    eventData : Event
)

매개 변수

  • eventData
    An Event object that encapsulates the data for a single event.

주의

An event provider calls the Write method to submit an event (encapsulated as an Event) to an EventCollector. The EventCollector gathers all submitted events into an event batch. The event batch is submitted to the Notification Services application database for processing when the event provider calls the Commit method.

The EventCollector creates a new event batch when the event provider first calls Write, and then again on the first Write call after an Abort or Commit call.

The following examples show how to use the Write method to dispose of an EventCollector object:

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

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

'Create an EventCollector object.
Dim myEventCollector As _
    New EventCollector(myApplication, eventProviderName)

'Add code here to populate the Event object.

'Use the Write method to write the event to the EventCollector.
myEventCollector.Write(myEvent)
string instanceName = "MyInstanceName";
string applicationName = "MyApplicationName";
string eventClassName = "MyEventClassName";
string eventProviderName = "MyEventProviderName";

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

//Create an EventCollector object.
EventCollector myEventCollector = 
    new EventCollector(myApplication, eventProviderName);

//Add code here to populate the Event object.

//Write the event to the EventCollector.
myEventCollector.Write(myEvent);

스레드 보안

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

플랫폼

개발 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

대상 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

EventCollector Class
EventCollector Members
Microsoft.SqlServer.NotificationServices Namespace