SimpleLeafCondition Class

Compares two Argument objects using relational operators and returns a Boolean result. This class cannot be inherited.

Пространство имен: Microsoft.SqlServer.NotificationServices.Rules
Сборка: Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)

Синтаксис

'Декларация
Public Class SimpleLeafCondition
    Inherits LeafCondition
public class SimpleLeafCondition : LeafCondition
public ref class SimpleLeafCondition : public LeafCondition
public class SimpleLeafCondition extends LeafCondition
public class SimpleLeafCondition extends LeafCondition

Замечания

You must set the Left, Right, and Operator properties using the properties or the SimpleLeafCondition constructor.

Inheritance Hierarchy

System.Object
   Microsoft.SqlServer.NotificationServices.Rules.RuleObject
     Microsoft.SqlServer.NotificationServices.Rules.Condition
       Microsoft.SqlServer.NotificationServices.Rules.LeafCondition
        Microsoft.SqlServer.NotificationServices.Rules.SimpleLeafCondition

Пример

The following examples show how to use a SimpleLeafCondition to define the conditions that need to be met by an event in order for Notification Services to generate a notification for the subscriber:

// 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.

Платформы

Платформы разработки

Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.

Целевые платформы

Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.

См. также

Справочник

SimpleLeafCondition Members
Microsoft.SqlServer.NotificationServices.Rules Namespace