次の方法で共有


PropertyRule Class

入力テーブルまたは入力ビュー内の任意の行に、スカラ値と評価されるロジックを定義します。このクラスは継承できません。

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

構文

'宣言
Public Class PropertyRule
    Inherits RuleLogic
public class PropertyRule : RuleLogic
public ref class PropertyRule : public RuleLogic
public class PropertyRule extends RuleLogic
public class PropertyRule extends RuleLogic

解説

プロパティ ルールには、"IF 条件 THEN 結果" という形式のステートメントが含まれています。ここで、結果はルール内の条件を評価することで決定されるスカラ値です。

PropertyStatements プロパティまたは PropertyRule(InputType,PropertyStatement[]) コンストラクタを使用して、少なくとも 1 つの PropertyStatement を定義する必要があります。複数のステートメントを定義すると、このルールの評価の結果は、Condition 条件を満たす場合に最初のステートメントの結果となり、どの条件も満たさない場合には NULL となります。

継承階層

System.Object
   Microsoft.SqlServer.NotificationServices.Rules.RuleObject
     Microsoft.SqlServer.NotificationServices.Rules.StoredRuleObject
       Microsoft.SqlServer.NotificationServices.Rules.RuleLogic
        Microsoft.SqlServer.NotificationServices.Rules.PropertyRule

使用例

次の例では、FewSome、および Alot という 3 つのプロパティを定義するプロパティ ルールを定義する方法を示します。このプロパティ ルールを使用して、QuantityFew であるイベントに対するサブスクリプションを定義します。

// Define a new property that defines "Few," "Some," and "Alot"
// of inventory. 
PropertyRule quantityCategory = new PropertyRule(
    new ViewInputType(eventView),
    new PropertyStatement(new SimpleLeafCondition(
        new FieldValue("Quantity"),
        SimpleOperator.LessThan, 100), "Few"),
    new PropertyStatement(new BetweenLeafCondition(
        new FieldValue("Quantity"), 100, 200), "Some"),
    new PropertyStatement(new SimpleLeafCondition(
            new FieldValue("Quantity"),
            SimpleOperator.GreaterThan, 200),
        "Alot"));

// Create subscription and define basic properties.
s = new Subscription(nsApplication, subscriptionClassName);
s.SubscriberId = "Scott";
s.Enabled = true;
s.RuleName = "InventoryTrackerRule";
s.SetFieldValue("DeviceName", "myDevice");
s.SetFieldValue("SubscriberLocale", "en-us");


// Use the new property to return only products with "few" remaining
// in inventory. Note that the category definition can be reused.
s.Condition = new SimpleLeafCondition(
    new RuleValue(quantityCategory),
    SimpleOperator.Equals,
    "Few");

// Add subscription.
s.Add();

スレッド セーフ

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

プラットフォーム

開発プラットフォーム

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

対象プラットフォーム

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

参照

関連項目

PropertyRule Members
Microsoft.SqlServer.NotificationServices.Rules Namespace