HostedEventProvider Class
Represents a hosted event provider for a Notification ServicesApplication.
命名空間: Microsoft.SqlServer.Management.Nmo
組件: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
語法
'宣告
Public NotInheritable Class HostedEventProvider
Inherits NamedSmoObject
public sealed class HostedEventProvider : NamedSmoObject
public ref class HostedEventProvider sealed : public NamedSmoObject
public final class HostedEventProvider extends NamedSmoObject
public final class HostedEventProvider extends NamedSmoObject
備註
Event providers collect event data and submit it to an event class. Each collected event is persisted as a single row in the event class table in the application database.
Hosted event providers are run by the Notification Services engine. Notification Services has three built-in hosted event providers. You can also use custom hosted event providers.
Hosted event providers are optional. If you do not use hosted event providers, you can use non-hosted event providers or the event submission stored procedures.
For more information, see 定義事件提供者.
Inheritance Hierarchy
System.Object
Microsoft.SqlServer.Management.Smo.SmoObjectBase
Microsoft.SqlServer.Management.Smo.SqlSmoObject
Microsoft.SqlServer.Management.Smo.NamedSmoObject
Microsoft.SqlServer.Management.Nmo.HostedEventProvider
範例
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)
執行緒安全性
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 的硬體和軟體需求>。
請參閱
參考
HostedEventProvider Members
Microsoft.SqlServer.Management.Nmo Namespace