Share via


Subscription.Condition Property

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

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

構文

'宣言
Public Property Condition As Condition
public Condition Condition { get; set; }
public:
property Condition^ Condition {
    Condition^ get ();
    void set (Condition^ value);
}
/** @property */
public Condition get_Condition ()

/** @property */
public void set_Condition (Condition value)
public function get Condition () : Condition

public function set Condition (value : Condition)

プロパティ値

サブスクリプションの条件を示す Microsoft.SqlServer.NotificationServices.Rules.Condition オブジェクトです。

解説

ms149138.note(ja-jp,SQL.90).gifメモ :
このメソッドは、COM 相互運用機能をサポートしません。

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

1 つのサブスクリプション クラスは、パラメータ ベースのアクションと条件アクションをサポートします。条件アクションを使用するサブスクリプションでは、ConditionRuleName の両方のプロパティが必要です。条件アクションを使用しないサブスクリプションでは、これらのプロパティは必要ありません。

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

サブスクリプション管理インターフェイスには、条件で参照される各オブジェクトに対する VIEW DEFINITION 権限が必要です。通常、これらのオブジェクトは、入力テーブル、ビュー、および条件で使用される任意のユーザー定義関数です。たとえば、サブスクリプション管理インターフェイスが NSTestUser で実行される場合、次の Transact-SQL ステートメントを使用することにより、Sales.Customer ビューおよび dbo.ufnGetAccountEndDate ユーザー定義関数に対する権限を付与できます。

GRANT VIEW DEFINITION ON Sales.Customer TO NSTestUser;
GRANT VIEW DEFINITION ON dbo.ufnGetAccountingEndDate TO NSTestUser;

使用例

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

' Create the NSInstance object.
Dim testInstance As New NSInstance("InventoryTrackerInstance")
 
' Create the NSApplication object.
Dim testApplication As _
    New NSApplication(testInstance, "InventoryTracker")
 
' Define subscription properties
Dim s As New Subscription( _
    testApplication, "InventoryTrackerSubscriptions")
s.SubscriberId = "TestUser1"
s.Enabled = True
s.RuleName = "InventoryTrackerRule"
s("DeviceName") = "Work e-mail"
s("SubscriberLocale") = "en-US"
 
' Define OrCondition
s.Condition = New OrCondition( _
    New SimpleLeafCondition( _
        New FieldValue("Quantity"), _
        SimpleOperator.GreaterThanOrEqualTo, _
        500), _
    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");

// Define subscription properties
Subscription s = new Subscription(testApplication, "InventoryTrackerSubscriptions");
s.SubscriberId = "TestUser1";
s.Enabled = true;
s.RuleName = "InventoryTrackerRule";
s["DeviceName"] = "Work e-mail";
s["SubscriberLocale"] = "en-US";

// Define OrCondition
s.Condition = new OrCondition(
    new SimpleLeafCondition(new FieldValue("Quantity"),
        SimpleOperator.GreaterThanOrEqualTo,
        500),
    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

その他の技術情報

VIEW DEFINITION 権限