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


Application.HostedEventProviders Property

Gets a HostedEventProviderCollection object, which contains the set of hosted event providers for the Notification Services application.

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

Синтаксис

'Декларация
Public ReadOnly Property HostedEventProviders As HostedEventProviderCollection
public HostedEventProviderCollection HostedEventProviders { get; }
public:
property HostedEventProviderCollection^ HostedEventProviders {
    HostedEventProviderCollection^ get ();
}
/** @property */
public HostedEventProviderCollection get_HostedEventProviders ()
public function get HostedEventProviders () : HostedEventProviderCollection

Значение свойства

A HostedEventProviderCollection object.

Замечания

Hosted event providers are event collection components that are hosted by the Notification Services engine and submit events to the application. An application can have zero or more hosted event providers. An application can also use non-hosted event providers.

Use the methods of the HostedEventProviderCollection class to add or remove HostedEventProvider objects.

Пример

The following examples show how to define a hosted event provider and add it to an application using this HostedEventProviders property:

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

Синхронизация потоков

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.

Платформы

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

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

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

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

См. также

Справочник

Application Class
Application Members
Microsoft.SqlServer.Management.Nmo Namespace
NonHostedEventProviders

Другие ресурсы

Определение поставщиков событий
Providers Element (ADF)