Compartir a través de


FilterRule.FilterStatements Property

Gets the collection of FilterStatement objects describing the logic of this instance.

Espacio de nombres: Microsoft.SqlServer.NotificationServices.Rules
Ensamblado: Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)

Sintaxis

'Declaración
Public ReadOnly Property FilterStatements As Collection(Of FilterStatement)
public Collection<FilterStatement> FilterStatements { get; }
public:
property Collection<FilterStatement^>^ FilterStatements {
    Collection<FilterStatement^>^ get ();
}
/** @property */
public Collection<FilterStatement> get_FilterStatements ()
public function get FilterStatements () : Collection<FilterStatement>

Valor de propiedad

A Collection of FilterStatement objects.

Notas

If you define multiple statements, a statement with an Exclude action takes precedence over a statement with an Include action. If no Include statement is defined, inputs are included by default. Otherwise, inputs are excluded by default.

Ejemplo

The following example shows a filter with one filter statement. The filter includes rows from the Production.Location table where the Name value is Subassembly. This filter is then used in a LinkLeafCondition, which joins the event and location data, including only those events that meet the filter conditions.

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

Seguridad para subprocesos

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.

Plataformas

Plataformas de desarrollo

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Plataformas de destino

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Vea también

Referencia

FilterRule Class
FilterRule Members
Microsoft.SqlServer.NotificationServices.Rules Namespace