Share via


SimpleLeafCondition Class

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

Namespace: Microsoft.SqlServer.NotificationServices.Rules
Assembly : Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)

Syntax

'Declaration
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

Hinweise

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

Beispiel

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()

Threadsicherheit

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.

Plattformen

Entwicklungsplattformen

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Zielplattforme

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Siehe auch

Verweis

SimpleLeafCondition Members
Microsoft.SqlServer.NotificationServices.Rules Namespace