Freigeben über


HostedEventProvider Constructor (Application, String)

Initializes a new instance of the HostedEventProvider class with an Application and a name.

Namespace: Microsoft.SqlServer.Management.Nmo
Assembly : Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntax

'Declaration
Public Sub New ( _
    application As Application, _
    name As String _
)
public HostedEventProvider (
    Application application,
    string name
)
public:
HostedEventProvider (
    Application^ application, 
    String^ name
)
public HostedEventProvider (
    Application application, 
    String name
)
public function HostedEventProvider (
    application : Application, 
    name : String
)

Parameter

  • application
    The parent Application for the event provider. This parameter sets the Parent property.
  • name
    A String, between 1 and 255 characters in length, that specifies the name of the hosted event provider. The name must be unique within the application.

    You cannot change the name. To rename a hosted event provider, remove the provider and then add another.

Hinweise

Aktualisierter Text:05. Dezember 2005

Using this constructor, the default StartTime value is DateTime.MinValue and the default Timeout is 5 minutes.

Beispiel

The following examples show how to define a hosted event provider:

// Define a hosted event provider
HostedEventProvider flightEventProvider = 
    new HostedEventProvider(myApplication, "FlightEP");
flightEventProvider.ClassName = "FileSystemWatcherProvider";
flightEventProvider.SystemName = notificationServicesHost;

// Define event provider arguments
HostedEventProviderArgument fileArg_Directory = 
    new HostedEventProviderArgument(
    flightEventProvider, "WatchDirectory");
fileArg_Directory.Value = sampleDirectory + @"\Events";
flightEventProvider.HostedEventProviderArguments.Add(
    fileArg_Directory);

HostedEventProviderArgument fileArg_Schema = 
    new HostedEventProviderArgument(
    flightEventProvider, "SchemaFile");
fileArg_Schema.Value = sampleDirectory + 
    @"\AppDefinition\EventsSchema.xsd";
flightEventProvider.HostedEventProviderArguments.Add(
    fileArg_Schema);

HostedEventProviderArgument fileArg_EventClass = 
    new HostedEventProviderArgument(flightEventProvider, 
    "EventClassName");
fileArg_EventClass.Value = "FlightEvents";
flightEventProvider.HostedEventProviderArguments.Add(
    fileArg_EventClass);

myApplication.HostedEventProviders.Add(flightEventProvider);
' Define a hosted event provider
Dim flightEventProvider As HostedEventProvider = _
    New HostedEventProvider(myApplication, "FlightEP")
flightEventProvider.ClassName = "FileSystemWatcherProvider"
flightEventProvider.SystemName = notificationServicesHost

' Define event provider arguments
Dim fileArg_Directory As HostedEventProviderArgument = _
    New HostedEventProviderArgument(flightEventProvider, _
        "WatchDirectory")
fileArg_Directory.Value = sampleDirectory + "\Events"
flightEventProvider.HostedEventProviderArguments.Add( _
    fileArg_Directory)

Dim fileArg_Schema As HostedEventProviderArgument = _
    New HostedEventProviderArgument(flightEventProvider, _
        "SchemaFile")
fileArg_Schema.Value = sampleDirectory + _
    "\AppDefinition\EventsSchema.xsd"
flightEventProvider.HostedEventProviderArguments.Add( _
    fileArg_Schema)

Dim fileArg_EventClass As HostedEventProviderArgument = _
    New HostedEventProviderArgument(flightEventProvider, _
    "EventClassName")
fileArg_EventClass.Value = "FlightEvents"
flightEventProvider.HostedEventProviderArguments.Add( _
    fileArg_EventClass)

myApplication.HostedEventProviders.Add(flightEventProvider)

Plattformen

Entwicklungsplattformen

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Zielplattforme

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Siehe auch

Verweis

HostedEventProvider Class
HostedEventProvider Members
Microsoft.SqlServer.Management.Nmo Namespace

Andere Ressourcen

Definieren von gehosteten Ereignisanbietern
HostedProvider Element (ADF)