OrCondition Class
Defines a set of Condition objects to be logically evaluated using OR Boolean logic. This class cannot be inherited.
命名空间: Microsoft.SqlServer.NotificationServices.Rules
程序集: Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)
语法
声明
Public Class OrCondition
Inherits ConditionTree
public class OrCondition : ConditionTree
public ref class OrCondition : public ConditionTree
public class OrCondition extends ConditionTree
public class OrCondition extends ConditionTree
备注
When an OrCondition tree is added to a rule, the tree evaluates to true if any child conditions is true.
You must specify at least one child condition using the OrCondition constructor or the inherited Children property.
Inheritance Hierarchy
System.Object
Microsoft.SqlServer.NotificationServices.Rules.RuleObject
Microsoft.SqlServer.NotificationServices.Rules.Condition
Microsoft.SqlServer.NotificationServices.Rules.ConditionTree
Microsoft.SqlServer.NotificationServices.Rules.OrCondition
示例
The following example shows how to use an OrCondition object to define a Condition for a Notification Services subscription. This condition consists of two SimpleLeafCondition objects. If either SimpleLeafCondition object evaluates to true, the OrCondition is true.
// 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();
' 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()
线程安全
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.
平台
开发平台
有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。
目标平台
有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。
请参阅
参考
OrCondition Members
Microsoft.SqlServer.NotificationServices.Rules Namespace