次の方法で共有


SubscriptionClass.SubscriptionEventRules Property

サブスクリプション クラスに使用するパラメータ ベースのイベント ルールのコレクションを取得します。

名前空間: Microsoft.SqlServer.Management.Nmo
アセンブリ: Microsoft.SqlServer.Smo (microsoft.sqlserver.smo.dll 内)

構文

'宣言
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

プロパティ値

サブスクリプション クラスに対応する SubscriptionEventRuleCollection です。

解説

SubscriptionEventRuleCollection は、サブスクリプション クラスに使用するパラメータ ベースの SubscriptionEventRule オブジェクトのセットを表します。サブスクリプション クラスの SubscriptionEventRule オブジェクトを取得、追加、および削除するには、このコレクションを使用します。

使用例

次の例は、イベント ドリブンのサブスクリプション ルールを定義してサブスクリプション クラスに追加する方法を示しています。

// 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)

スレッド セーフ

この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

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

その他の技術情報

EventRules 要素 (ADF)
イベント ルールの定義