HostedEventProvider.StartTime Property

Gets or sets a time of day used to calculate each of the invocation times for the hosted event provider.

命名空间: Microsoft.SqlServer.Management.Nmo
程序集: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

语法

声明
Public Property StartTime As DateTime
public DateTime StartTime { get; set; }
public:
property DateTime StartTime {
    DateTime get ();
    void set (DateTime value);
}
/** @property */
public DateTime get_StartTime ()

/** @property */
public void set_StartTime (DateTime value)
public function get StartTime () : DateTime

public function set StartTime (value : DateTime)

属性值

A DateTime object that specifies the event provider start time.

备注

The StartTime value must be specified in UTC.

If you do not provide a StartTime value, Notification Services runs the event provider for the first time when the instance starts or when you enable the event provider.

If you do provide a StartTime value, Notification Services runs the provider as follows:

  • Notification Services calculates the invocation times for the 24-hour period starting at the StartTime value.

  • Notification Services first invokes the event provider at the next calculated invocation time.

To remove a start time value, set the value to DateTime.MinValue. Notification Services uses the value to set the StartTime to NULL when you update the application.

The table shows examples of invocation schedules given various StartTime and Interval values.

Schedule

Values and Description

Every hour on the half hour

StartTime time value is 1:30 (or any other half hour).

Interval value is PT1H.

The event provider first runs at the next half-hour, such as 0:30, 1:30, 2:30, and so on, up to 23:30).

Every 3 hours on the hour starting at 1:00

StartTime time value is 1:00.

Interval value is PT3H.

The event provider first runs at the next 3-hour interval in the following list: 1:00, 4:00, 7:00, 10:00, 13:00, 16:00, 19:00, 22:00.

Every 6 hours starting at 12:00

StartTime time value is 12:00.

Interval value is PT6H.

The event provider first runs at the next 6-hour interval in the following list: 0:00, 6:00, 12:00, 18:00.

At 4:00 each day

StartTime time value is 4:00.

Interval value is PT24H.

The event provider runs at 4:00 each day regardless of what time it is started.

示例

The following example shows how define a hosted event provider with no start time. This event provider runs as soon as the event provider host starts.

// Define a hosted event provider and set properties.
HostedEventProvider flightEventProvider = new HostedEventProvider();
flightEventProvider.Parent = myApplication;
flightEventProvider.Name = "FlightEP";
flightEventProvider.StartTime = DateTime.MinValue;
flightEventProvider.Timeout = new TimeSpan(0, 5, 0);
flightEventProvider.ClassName = "FileSystemWatcherProvider";
flightEventProvider.AssemblyName = "";
flightEventProvider.SystemName = notificationServicesHost;
' Define a hosted event provider and set properties.
Dim flightEventProvider As HostedEventProvider = _
    New HostedEventProvider()
flightEventProvider.Parent = myApplication
flightEventProvider.Name = "FlightEP"
flightEventProvider.StartTime = DateTime.MinValue
flightEventProvider.Timeout = New TimeSpan(0, 5, 0)
flightEventProvider.ClassName = "FileSystemWatcherProvider"
flightEventProvider.AssemblyName = ""
flightEventProvider.SystemName = notificationServicesHost

线程安全

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 Class
HostedEventProvider Members
Microsoft.SqlServer.Management.Nmo Namespace

其他资源

定义宿主事件提供程序
StartTime Element for HostedProvider/Schedule (ADF)