Share via


SubscriptionClass.SubscriptionEventRules Property

Gets the collection of parameter-based event rules for the subscription class.

Namespace: Microsoft.SqlServer.Management.Nmo
Assembly : Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntax

'Declaration
Public ReadOnly Property SubscriptionEventRules As SubscriptionEventRuleCollection
public SubscriptionEventRuleCollection SubscriptionEventRules { get; }
public:
property SubscriptionEventRuleCollection^ SubscriptionEventRules {
    SubscriptionEventRuleCollection^ get ();
}
/** @property */
public SubscriptionEventRuleCollection get_SubscriptionEventRules ()
public function get SubscriptionEventRules () : SubscriptionEventRuleCollection

Eigenschaftswert

The SubscriptionEventRuleCollection for the subscription class.

Hinweise

The SubscriptionEventRuleCollection represents the set of parameter-based SubscriptionEventRule objects for the subscription class. Use this collection to get, add, and remove SubscriptionEventRule objects for the subscription class.

Beispiel

The following examples show how to define and add an event-driven subscription rule to a subscription class:

// Add a rule to generate basic event-triggered notifications
SubscriptionEventRule flightEventRule = 
    new SubscriptionEventRule(flightSubscriptions, 
    "FlightSubscriptionsEventRule");
flightEventRule.Action = "INSERT INTO FlightNotifications " + 
    "(SubscriberId, DeviceName, SubscriberLocale, " + 
    "LeavingFrom, GoingTo, Price) " + 
    "SELECT S.SubscriberId, S.DeviceName, S.SubscriberLocale, " + 
    "E.LeavingFrom, E.GoingTo, E.Price " + 
    "FROM FlightEvents E, FlightSubscriptions S " + 
    "WHERE     E.LeavingFrom     = S.LeavingFrom " + 
    "AND    E.GoingTo    = S.GoingTo " + 
    "AND    E.Price    < S.Price";
flightEventRule.ActionTimeout = new TimeSpan(0, 1, 0);
flightEventRule.EventClassName = "FlightEvents";
flightSubscriptions.SubscriptionEventRules.Add(flightEventRule);
' Add a rule to generate basic event-triggered notifications
Dim flightEventRule As SubscriptionEventRule = _
    New SubscriptionEventRule(flightSubscriptions, _
        "FlightSubscriptionsEventRule")
flightEventRule.Action = _
    "INSERT INTO FlightNotifications " + _
    "(SubscriberId, DeviceName, SubscriberLocale, " + _
    "LeavingFrom, GoingTo, Price) " + _
    "SELECT S.SubscriberId, S.DeviceName, S.SubscriberLocale, " + _
    "E.LeavingFrom, E.GoingTo, E.Price " + _
    "FROM FlightEvents E, FlightSubscriptions S " + _
    "WHERE E.LeavingFrom = S.LeavingFrom " + _
    "AND E.GoingTo = S.GoingTo " + _
    "AND E.Price < S.Price"
flightEventRule.ActionTimeout = New TimeSpan(0, 1, 0)
flightEventRule.EventClassName = "FlightEvents"
flightSubscriptions.SubscriptionEventRules.Add(flightEventRule)

Threadsicherheit

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.

Plattformen

Entwicklungsplattformen

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Zielplattforme

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Siehe auch

Verweis

SubscriptionClass Class
SubscriptionClass Members
Microsoft.SqlServer.Management.Nmo Namespace
SubscriptionClass.SubscriptionConditionEventRules Property

Andere Ressourcen

EventRules Element (ADF)
Definieren von Ereignisregeln