次の方法で共有


Subscription.RuleName Property

ルールベース サブスクリプションのサブスクリプション ルール名を取得します。値の設定も可能です。このクラスは、条件アクションを含むサブスクリプション クラスで使用されます。

名前空間: Microsoft.SqlServer.NotificationServices
アセンブリ: Microsoft.SqlServer.NotificationServices (microsoft.sqlserver.notificationservices.dll 内)

構文

'宣言
Public Property RuleName As String
public string RuleName { get; set; }
public:
property String^ RuleName {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_RuleName ()

/** @property */
public void set_RuleName (String value)
public function get RuleName () : String

public function set RuleName (value : String)

プロパティ値

条件アクションを使用するサブスクリプション ルール (イベント ドリブンまたは定期的なルール) の名前を表す文字列です。

解説

SQL Server 2000 Notification Services では、サブスクライバが、定義済みクエリのパラメータ値を定義してサブスクリプションを作成します。SQL Server 2005 Notification Services では、サブスクリプション クラスに条件アクションを含めることができます。これにより、サブスクライバはより複雑な条件を定義できます。

アプリケーションで条件アクションを使用する場合は、サブスクリプション管理アプリケーションで Condition プロパティおよびこの条件の RuleName を指定する必要があります。

RuleName プロパティは、サブスクリプションで使用するサブスクリプション ルールを指定します。このプロパティは、条件エバリュエータが正しいビューに対して条件を実行するために、条件ベースのサブスクリプションで必須です。

条件の詳細については、「条件アクションの定義」を参照してください。

使用例

サブスクリプションの条件を定義する例を次に示します。

' Create the NSInstance object.
Dim testInstance As New NSInstance("InventoryTrackerInstance")
 
' Create the NSApplication object.
Dim testApplication As _
    New NSApplication(testInstance, "InventoryTracker")
 
' Create Subscription object.
Dim s As New Subscription(testApplication, _
    "InventoryTrackerSubscriptions")
 
' Define subscription properties
s.SubscriberId = "TestUser1"
s.Enabled = True
s.RuleName = "InventoryTrackerRule"
s("DeviceName") = "Work e-mail"
s("SubscriberLocale") = "en-US"
 
' Define OrCondition
s.Condition = New AndCondition( _
    New SimpleLeafCondition( _
        New FieldValue("ProductName"), _
        SimpleOperator.Equals, _
        "Road-250 Black, 48"), _
    New SimpleLeafCondition( _
        New FieldValue("LocationName"), _
        SimpleOperator.Equals, _
        "Final Assembly"), _
    New SimpleLeafCondition( _
        New FieldValue("Quantity"), _
        SimpleOperator.LessThanOrEqualTo, _
        35))
 
' Add subscription
s.Add()
// Create the NSInstance object.
NSInstance testInstance = 
    new NSInstance("InventoryTrackerInstance");

// Create the NSApplication object.
NSApplication testApplication =
    new NSApplication(testInstance, "InventoryTracker");

// Create Subscription object.
Subscription s = new Subscription(testApplication, 
    "InventoryTrackerSubscriptions");

// Define subscription properties
s.SubscriberId = "TestUser1";
s.Enabled = true;
s.RuleName = "InventoryTrackerRule";
s["DeviceName"] = "Work e-mail";
s["SubscriberLocale"] = "en-US";

// Define OrCondition
s.Condition = new AndCondition(
    new SimpleLeafCondition(new FieldValue("ProductName"),
                    SimpleOperator.Equals,
                    "Road-250 Black, 48"),
    new SimpleLeafCondition(new FieldValue("LocationName"),
                    SimpleOperator.Equals,
                    "Final Assembly"),
    new SimpleLeafCondition(new FieldValue("Quantity"),
                    SimpleOperator.LessThanOrEqualTo,
                    35)
);

// Add subscription
s.Add();

スレッド セーフ

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

プラットフォーム

開発プラットフォーム

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

対象プラットフォーム

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

参照

関連項目

Subscription Class
Subscription Members
Microsoft.SqlServer.NotificationServices Namespace