FilterRule Constructor (InputType, FilterStatement[])
Initializes a new instance of the FilterRule class with a table or view input and one or more filter statements.
Espacio de nombres: Microsoft.SqlServer.NotificationServices.Rules
Ensamblado: Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)
Sintaxis
'Declaración
Public Sub New ( _
inputType As InputType, _
ParamArray filterStatements As FilterStatement() _
)
public FilterRule (
InputType inputType,
params FilterStatement[] filterStatements
)
public:
FilterRule (
InputType^ inputType,
... array<FilterStatement^>^ filterStatements
)
public FilterRule (
InputType inputType,
FilterStatement[] filterStatements
)
public function FilterRule (
inputType : InputType,
... filterStatements : FilterStatement[]
)
Parámetros
- inputType
The InputType that represents the input table or view. This parameter sets the InputType property.
- filterStatements
Zero or more FilterStatement objects used to evaluate the input. This parameter sets the FilterStatements property.
Notas
You can define zero statements for the filterStatements parameter, but you then must define at least one FilterStatement in for the FilterRule using the FilterStatements property.
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 how to define a filter over the event view. The inputType for the filter is the Production.Location table. The filterStatements are one condition that defines a SimpleLeafCondition of Name equals Subassembly.
// 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();
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