|
|
|
IMPORTANT! Remember that only rules of evaluation type can be used in data filtering, where they are called filters. It simply doesn't make sense to use execution type rules in data filtering.
Queryable.Filter method
Declaring Class: CodeEffects.Rule.Core.RuleExtensions
Assembly: CodeEffects.Rule.dll
Provides rule-based data filtering capabilities to LINQ to SQL and LINQ To Entity queries where the exact type of the source object is not known at design-time. Uses the plain evaluator class.
Returns
IQueryable whose elements are filtered according to conditions of the business rule.
Syntax
public static IQueryable Filter(
this IQueryable source,
Type type,
string rulesetXml,
string ruleId = null,
GetRuleDelegate getRule = null)
Type Parameters
- source, System.Collections.IQueryable - A sequence of values of the source object's type to filter against the business rule.
Parameters
- type, System.Type - Type of the source object that the rule was created with/for.
- rulesetXml, System.String - This string can contain either a single Rule XML document, or an outer XML of a single <rule> node that contains a business rule, or a collection of rules called the ruleset.
- ruleId, System.String - If the Rule XML passed in the previous parameter is a ruleset then this nullable parameter contains the ID of the particular rule located inside of that ruleset.
- getRule, CodeEffects.Rule.Core.GetRuleDelegate - This nullable parameter takes a reference to a method that returns string Rule XML by rule ID. Pass this delegate if your rule(s) may potentially reference reusable rules while the first parameter is not a ruleset or does not contain the referenced reusable rules.
Queryable.Filter<TSource> method
Declaring Class: CodeEffects.Rule.Core.RuleExtensions
Assembly: CodeEffects.Rule.dll
Provides rule-based data filtering capabilities to LINQ to SQL and LINQ To Entity queries. Uses the generic evaluator class.
Returns
IQueryable<TSource> whose elements are filtered according to conditions of the business rule.
Syntax
public static IQueryable<TSource> Filter<TSource>(
this IQueryable<TSource> source,
string rulesetXml,
string ruleId = null,
GetRuleDelegate getRule = null)
Type Parameters
- source, System.Collections.IQueryable<TSource> - A sequence of values of TSource type to filter against the business rule.
Parameters
- rulesetXml, System.String - This string can contain either a single Rule XML document, or an outer XML of a single <rule> node that contains a business rule, or a collection of rules called the ruleset.
- ruleId, System.String - If the Rule XML passed in the previous parameter is a ruleset then this nullable parameter contains the ID of the particular rule located inside of that ruleset.
- getRule, CodeEffects.Rule.Core.GetRuleDelegate - This nullable parameter takes a reference to a method that returns string Rule XML by rule ID. Pass this delegate if your rule(s) may potentially reference reusable rules while the first parameter is not a ruleset or does not contain the referenced reusable rules.
|