次の方法で共有


AndCondition Class

AND ブール論理によって論理的に評価される、一連の Condition オブジェクトを定義します。このクラスは継承できません。

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

構文

'宣言
Public Class AndCondition
    Inherits ConditionTree
public class AndCondition : ConditionTree
public ref class AndCondition : public ConditionTree
public class AndCondition extends ConditionTree
public class AndCondition extends ConditionTree

解説

AndCondition ツリーがルールに追加されると、すべての子条件が true である場合に、ツリーは true と評価されます。

AndCondition コンストラクタまたは継承される Children プロパティを使用して、少なくとも 1 つの子条件を指定する必要があります。

継承階層

System.Object
   Microsoft.SqlServer.NotificationServices.Rules.RuleObject
     Microsoft.SqlServer.NotificationServices.Rules.Condition
       Microsoft.SqlServer.NotificationServices.Rules.ConditionTree
        Microsoft.SqlServer.NotificationServices.Rules.AndCondition

使用例

AndCondition オブジェクトを使用して Notification Services サブスクリプションの Condition を定義する例を次に示します。この条件は、3 つの SimpleLeafCondition オブジェクトで構成されています。すべての SimpleLeafCondition オブジェクトが true と評価される場合、AndConditiontrue です。

// 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();
' 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()

スレッド セーフ

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

プラットフォーム

開発プラットフォーム

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

対象プラットフォーム

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

参照

関連項目

AndCondition Members
Microsoft.SqlServer.NotificationServices.Rules Namespace