SubscriptionEventRule.EventClassName Property

Gets or sets the name of the event class associated with the event rule.

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

Syntax

'Declaration
Public Property EventClassName As String
public string EventClassName { get; set; }
public:
property String^ EventClassName {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_EventClassName ()

/** @property */
public void set_EventClassName (String value)
public function get EventClassName () : String

public function set EventClassName (value : String)

Property Value

A String, between 1 and 64 characters in length, that specifies the name of the associated EventClass.

Remarks

Each event rule must be associated with a single event class. Notification Services fires the event rule only after processing event batches from the specified event class.

Example

The following examples show how to define an event rule and then add it 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)

Thread Safety

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.

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

SubscriptionEventRule Class
SubscriptionEventRule Members
Microsoft.SqlServer.Management.Nmo Namespace

Other Resources

Defining Event Rules
EventClassName Element for EventRule (ADF)
EventRule Element (ADF)