RuleValue Class
Represents an Argument that obtains its value from the evaluation of other RuleLogic instances.
Пространство имен: Microsoft.SqlServer.NotificationServices.Rules
Сборка: Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)
Синтаксис
'Декларация
Public Class RuleValue
Inherits Argument
public class RuleValue : Argument
public ref class RuleValue : public Argument
public class RuleValue extends Argument
public class RuleValue extends Argument
Замечания
The RuleValue class allows you to use the result of other rule evaluations as a value in a rule.
You must provide a rule in the RuleValue(RuleLogic) constructor or using the Rule property; this rule must have the same InputType value as the rule or condition you are defining.
A RuleLogic instance of type FilterRule has a Boolean return value; an instance of type PropertyRule has a return type determined by the Result property.
Inheritance Hierarchy
System.Object
Microsoft.SqlServer.NotificationServices.Rules.RuleObject
Microsoft.SqlServer.NotificationServices.Rules.Argument
Microsoft.SqlServer.NotificationServices.Rules.RuleValue
Пример
The following example shows how to use a rule value to obtain the logic for a SimpleLeafCondition from a PropertyRule. The SimpleLeafCondition to evaluate the Quantity field for a value that matches the definition of Few:
// 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();
Синхронизация потоков
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Платформы
Платформы разработки
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
Целевые платформы
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
См. также
Справочник
RuleValue Members
Microsoft.SqlServer.NotificationServices.Rules Namespace