다음을 통해 공유


SubscriptionConditionEventRule Class

Describes an event rule that uses condition actions to generate notifications.

네임스페이스: Microsoft.SqlServer.Management.Nmo
어셈블리: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

구문

‘선언
Public NotInheritable Class SubscriptionConditionEventRule
    Inherits NamedSmoObject
public sealed class SubscriptionConditionEventRule : NamedSmoObject
public ref class SubscriptionConditionEventRule sealed : public NamedSmoObject
public final class SubscriptionConditionEventRule extends NamedSmoObject
public final class SubscriptionConditionEventRule extends NamedSmoObject

주의

A SubscriptionConditionEventRule object is a subscription rule that runs during each generator quantum that has an event batch to process, and runs against subscriptions that use conditions.

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

For more information about subscription rules, see 구독 규칙 정의.

Add individual SubscriptionConditionEventRule objects to a SubscriptionClass object using the SubscriptionConditionEventRules property, which returns a SubscriptionConditionEventRuleCollection object.

Inheritance Hierarchy

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

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)

스레드 보안

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 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

SubscriptionConditionEventRule Members
Microsoft.SqlServer.Management.Nmo Namespace

관련 자료

이벤트 규칙 정의
조건 작업 정의
EventRule Element (ADF)
ConditionAction Element (ADF)