SubscriptionConditionScheduledRule Class

Describes a scheduled rule that uses condition actions to generate notifications.

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

Syntaxe

'Déclaration
Public NotInheritable Class SubscriptionConditionScheduledRule
    Inherits NamedSmoObject
public sealed class SubscriptionConditionScheduledRule : NamedSmoObject
public ref class SubscriptionConditionScheduledRule sealed : public NamedSmoObject
public final class SubscriptionConditionScheduledRule extends NamedSmoObject
public final class SubscriptionConditionScheduledRule extends NamedSmoObject

Notes

A SubscriptionConditionScheduledRule object is a subscription rule that runs during each generator quantum that has subscriptions to process, and runs against scheduled subscriptions that use conditions.

A SubscriptionClass object can have zero or more SubscriptionConditionScheduledRule objects. A SubscriptionClass object can also use the following types of subscription rules: SubscriptionConditionEventRule, SubscriptionEventRule, and SubscriptionScheduledRule.

For more information about subscription rules, see Définition de règles d'abonnement.

Add individual SubscriptionConditionScheduledRule objects to a SubscriptionClass object using the SubscriptionConditionScheduledRules property, which returns a SubscriptionConditionScheduledRuleCollection object.

Inheritance Hierarchy

System.Object
   Microsoft.SqlServer.Management.Smo.SmoObjectBase
     Microsoft.SqlServer.Management.Smo.SqlSmoObject
       Microsoft.SqlServer.Management.Smo.NamedSmoObject
        Microsoft.SqlServer.Management.Nmo.SubscriptionConditionScheduledRule

Exemple

The following examples show how to define a condition-based, scheduled subscription rule and add it to a subscription class:

// Add a rule to generate condition-based, scheduled notifications
SubscriptionConditionScheduledRule flightConditionScheduledRule = 
    new SubscriptionConditionScheduledRule(
    flightSubscriptions, "FlightConditionScheduledRule");
flightConditionScheduledRule.ActionTimeout = 
    new TimeSpan(0, 2, 0);
flightConditionScheduledRule.SqlLoginName = "MyLowPrivLogin";
flightConditionScheduledRule.SqlUserName = "MyLowPrivUser";
flightConditionScheduledRule.InputTypeName = "FlightEventChronicle";
flightConditionScheduledRule.InputTypeSchema = "MyAppSchema";
flightConditionScheduledRule.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.FlightConditionScheduledRule;";
flightSubscriptions.SubscriptionConditionScheduledRules.Add(
    flightConditionScheduledRule);
' Add a rule to generate condition-based, scheduled notifications
Dim flightConditionScheduledRule As _
    SubscriptionConditionScheduledRule = _
    New SubscriptionConditionScheduledRule( _
    flightSubscriptions, "FlightConditionScheduledRule")
flightConditionScheduledRule.ActionTimeout = _
    New TimeSpan(0, 2, 0)
flightConditionScheduledRule.SqlLoginName = "MyLowPrivLogin"
flightConditionScheduledRule.SqlUserName = "MyLowPrivUser"
flightConditionScheduledRule.InputTypeName = _
    "FlightEventChronicle"
flightConditionScheduledRule.InputTypeSchema = "MyAppSchema"
flightConditionScheduledRule.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.FlightConditionScheduledRule;"
flightSubscriptions.SubscriptionConditionScheduledRules.Add( _
    flightConditionScheduledRule)

Sécurité des threads

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.

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

SubscriptionConditionScheduledRule Members
Microsoft.SqlServer.Management.Nmo Namespace

Autres ressources

Définition de règles planifiées
Définition des actions de condition
ScheduledRule Element (ADF)
ConditionAction Element (ADF)