FilterRule Class
Defines a filter over an input table or view based on the results of condition evaluation. This class cannot be inherited.
네임스페이스: Microsoft.SqlServer.NotificationServices.Rules
어셈블리: Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)
구문
‘선언
Public Class FilterRule
Inherits RuleLogic
public class FilterRule : RuleLogic
public ref class FilterRule : public RuleLogic
public class FilterRule extends RuleLogic
public class FilterRule extends RuleLogic
주의
A filter rule defines a filter over a table or view. The filter rule contains statements in the form "IF <Condition> THEN <Action>" where the action is to include or exclude items in the input based on defined conditions.
You must define at least one FilterStatement in the FilterStatements collection.
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.
Inheritance Hierarchy
System.Object
Microsoft.SqlServer.NotificationServices.Rules.RuleObject
Microsoft.SqlServer.NotificationServices.Rules.StoredRuleObject
Microsoft.SqlServer.NotificationServices.Rules.RuleLogic
Microsoft.SqlServer.NotificationServices.Rules.FilterRule
예
The following example shows how to define a filter over the event view. When used by a subscription, this filter restricts the set of events to only those products that are in the subassembly production phase.
// 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();
스레드 보안
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.
플랫폼
개발 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
대상 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
참고 항목
참조
FilterRule Members
Microsoft.SqlServer.NotificationServices.Rules Namespace