Partager via


HostedEventProvider Constructor (Application, String)

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

Espace de noms: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntaxe

'Déclaration
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
)

Paramètres

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

Notes

Texte mis à jour :5 décembre 2005

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

Exemple

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)

Plateformes

Plateformes de développement

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Plateformes cibles

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Voir aussi

Référence

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

Autres ressources

Définition de fournisseurs d'événements hébergés
HostedProvider Element (ADF)