SubscriptionConditionEventRule Constructor (SubscriptionClass, String)
Initializes a new instance of the SubscriptionConditionEventRule class with a parent SubscriptionClass object and a name.
Пространство имен: Microsoft.SqlServer.Management.Nmo
Сборка: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
Синтаксис
'Декларация
Public Sub New ( _
subscriptionClass As SubscriptionClass, _
name As String _
)
public SubscriptionConditionEventRule (
SubscriptionClass subscriptionClass,
string name
)
public:
SubscriptionConditionEventRule (
SubscriptionClass^ subscriptionClass,
String^ name
)
public SubscriptionConditionEventRule (
SubscriptionClass subscriptionClass,
String name
)
public function SubscriptionConditionEventRule (
subscriptionClass : SubscriptionClass,
name : String
)
Параметры
- subscriptionClass
The parent SubscriptionClass for the SubscriptionConditionEventRule. The rule is evaluated for condition-based subscriptions in the specified subscription class.
name
A String, between 1 and 255 characters in length, that specifies the event rule name.You cannot change the name. To rename a rule, you must remove it and then add a rule that has the new name.
Замечания
The name string must be unique within the application.
This constructor sets a default ActionTimeout value of 30 minutes.
Пример
The following example shows how to define a condition-based, event-driven subscription rule and add it to a subscription class:
// Add a rule to generate condition-based, event notifications
SubscriptionConditionEventRule flightConditionEventRule =
new SubscriptionConditionEventRule(
flightSubscriptions, "FlightConditionEventRule");
flightConditionEventRule.EventClassName = "FlightEvents";
flightConditionEventRule.ActionTimeout = new TimeSpan(0, 2, 0);
flightConditionEventRule.SqlLoginName = "MyLowPrivLogin";
flightConditionEventRule.SqlUserName = "MyLowPrivUser";
flightConditionEventRule.InputTypeName = "FlightEvents";
flightConditionEventRule.InputTypeSchema = "MyAppSchema";
flightConditionEventRule.SqlExpression =
"INSERT INTO MyAppSchema.FlightNotifications (SubscriberId, " +
"DeviceName, SubscriberLocale, LeavingFrom, GoingTo, Price) " +
"SELECT [Subscription.SubscriberId], [Subscription.DeviceName], " +
"[Subscription.SubscriberLocale], " +
"[Input.LeavingFrom], [Input.GoingTo], [Input.Price] " +
"FROM MyAppSchema.FlightConditionEventRule;";
flightSubscriptions.SubscriptionConditionEventRules.Add(
flightConditionEventRule);
' Add a rule to generate condition-based, event notifications
Dim flightConditionEventRule As _
SubscriptionConditionEventRule = _
New SubscriptionConditionEventRule( _
flightSubscriptions, "FlightConditionEventRule")
flightConditionEventRule.EventClassName = "FlightEvents"
flightConditionEventRule.ActionTimeout = New TimeSpan(0, 2, 0)
flightConditionEventRule.SqlLoginName = "MyLowPrivLogin"
flightConditionEventRule.SqlUserName = "MyLowPrivUser"
flightConditionEventRule.InputTypeName = "FlightEvents"
flightConditionEventRule.InputTypeSchema = "MyAppSchema"
flightConditionEventRule.SqlExpression = _
"INSERT INTO MyAppSchema.FlightNotifications " + _
"(SubscriberId, DeviceName, SubscriberLocale, LeavingFrom, " + _
"GoingTo, Price) SELECT [Subscription.SubscriberId], " + _
"[Subscription.DeviceName], [Subscription.SubscriberLocale], " + _
"[Input.LeavingFrom], [Input.GoingTo], [Input.Price] " + _
"FROM MyAppSchema.FlightConditionEventRule;"
flightSubscriptions.SubscriptionConditionEventRules.Add( _
flightConditionEventRule)
Платформы
Платформы разработки
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
Целевые платформы
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
См. также
Справочник
SubscriptionConditionEventRule Class
SubscriptionConditionEventRule Members
Microsoft.SqlServer.Management.Nmo Namespace
Другие ресурсы
Определение правил событий
Определение условных действий
EventRule Element (ADF)
ConditionAction Element (ADF)