LinkLeafCondition Class

Evaluates operations against the results of a related FilterRule object. This class cannot be inherited.

Espace de noms: Microsoft.SqlServer.NotificationServices.Rules
Assembly: Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)

Syntaxe

'Déclaration
Public Class LinkLeafCondition
    Inherits LeafCondition
public class LinkLeafCondition : LeafCondition
public ref class LinkLeafCondition : public LeafCondition
public class LinkLeafCondition extends LeafCondition
public class LinkLeafCondition extends LeafCondition

Notes

You must set the Filter property using the property or the LinkLeafCondition constructor.

Inheritance Hierarchy

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

Exemple

The following example shows how to define a filter and a subscription that uses that filter in a link leaf condition.

The filter determines which products are in the subassembly production phase. Only events that match the filter will be used when evaluating the subscription.

The subscription itself uses the Any operator, the toolCrib function just defined, and specifies the link chain between the event view and the product location, in which the event view is linked to the inventory table, which is linked to the location table:

// Subscribe to products in Subassembly location. This
// requires select permissions on all tables in the sample.

//Specify server and database.
Server server = new Server("MyServer");
Database db = server.Databases[nsApplication.DatabaseName];

// Specify tables and views used by the condition.
Table locationTable = db.Tables["Location", "Production"];
Table inventoryTable = db.Tables["ProductInventory", "Production"];
View eventView = db.Views["InventoryTrackerEvents",
    "NS_InventoryTrackerApplication"];

// Filter defining "Subassembly" locations.
FilterRule toolCrib = new FilterRule(
    new TableInputType(db.Tables["Location", "Production"]),
    new SimpleLeafCondition(new FieldValue("Name"),
        SimpleOperator.Equals, "Subassembly"));

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

// Define a condition using the filter.
s.Condition = new LinkLeafCondition(
    LinkLeafOperator.Any,
    toolCrib,
    new JoinClause(eventView.Columns["ProductId"],
        inventoryTable.Columns["ProductId"]),
    new JoinClause(inventoryTable.Columns["LocationId"],
        locationTable.Columns["LocationId"]));

// Add subscription.
s.Add();

Sécurité des threads

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.

Plateformes

Plateformes de développement

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Plateformes cibles

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Voir aussi

Référence

LinkLeafCondition Members
Microsoft.SqlServer.NotificationServices.Rules Namespace