Share via


EventCollector.Initialize Method

Initializes an instance of the EventCollector class.

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

Syntax

'Declaration
Public Sub Initialize ( _
    nsApplication As NSApplication, _
    providerName As String _
)
public void Initialize (
    NSApplication nsApplication,
    string providerName
)
public:
virtual void Initialize (
    NSApplication^ nsApplication, 
    String^ providerName
) sealed
public final void Initialize (
    NSApplication nsApplication, 
    String providerName
)
public final function Initialize (
    nsApplication : NSApplication, 
    providerName : String
)

Parameters

  • nsApplication
    An NSApplication that represents the Notification Services application to which this EventCollector submits events. This value is necessary for gathering event statistics for the given event provider.
  • providerName
    A String containing the name of the event provider for this event collector.

Remarks

The Initialize method is used in conjunction with the parameter-less constructor to enable COM interoperability. It must be called before any other property or method is called on an EventCollector object created with the parameter-less constructor.

Example

The following example shows how to create and initialize an EventCollector object in unmanaged Microsoft Visual Basic Scripting Edition (VBScript) code:

Dim myInstance, myApplication, myEventCollector

const instanceName = "MyInstanceName"
const applicationName = "MyApplicationName"
const eventProviderName = "MyEventProviderName"

'Create & initialize an NSInstance object.
set myInstance = WScript.CreateObject("Microsoft.SqlServer.NotificationServices.NSInstance")
myInstance.Initialize instanceName

'Create & initialize an NSApplication object.
set myApplication = WScript.CreateObject("Microsoft.SqlServer.NotificationServices.NSApplication")
myApplication.Initialize (myInstance), applicationName

'Create & initialize an EventCollector object.
set myEventCollector = WScript.CreateObject("Microsoft.SqlServer.NotificationServices.EventCollector")
myEventCollector.Initialize (myApplication), eventProviderName

Thread Safety

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.

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

EventCollector Class
EventCollector Members
Microsoft.SqlServer.NotificationServices Namespace