EvaluationParameters class
Namespace: CodeEffects.Rule.Core
This class can be used to pass parameters of the rule evaluation to one of the evaluator classes.
Syntax
public class EvaluationParameters
Properties
-
LINQProviderType Type: CodeEffects.Rule.Core.LinqProviderType
Gets or sets the type of LINQ provider. Right now only three providers are supported: LINQ-to-Object, LINQ-to-SQL, and LINQ-to-Entities. Other providers may work as well as long as they implement the same sub-set of commands as LINQ-to-SQL. Use the Default value for all other providers.
-
MaxIterations Type: System.Int32
Gets or sets the value of the maximum number of iterations before evaluation fails in the Loop mode. The default value of -1 sets no limits.
-
MidpointRounding Type: System.MidpointRounding
Gets or sets the rounding algorithm. The default value is System.MidpointRounding.ToEven, aka round-to-even or "Banker's Rounding". This is also the default .NET rounding algorithm. For traditional rounding set it to MidpointRounding.AwayFromZero.
-
PerformNullChecks Type: System.Boolean
Gets or sets the value indicating whether the engine builds null-pointer safety checks into compiled code to avoid run-time exceptions. The default value is True.
-
Precision Type: System.Int32
Gets or sets the number of fractional digits to round decimal or double values to. Rounding is done only in comparison operators using the Math.Round() method. The default value of -1 sets no rounding.
-
PreserveWhitespace Type: System.Boolean
Gets or sets the value indicating whether the rule editor should preserve white spaces in string values in Rule XML during the rule's generation. By default the rule editor trims all string values and leaves only single white spaces inside of string values. For example, if this property is set to False a string value " My name is John " will be saved in Rule XML as "My name is John". The default value is False.
-
RuleGetter Type: CodeEffects.Rule.Core.GetRuleDelegate
Delegate for requesting missing rules (rules that are being referenced but not included in the ruleset). This property is optional.
-
RuleId Type: System.String
Id of the rule to be evaluated or compiled. This property is optional.
-
Scope Type: CodeEffects.Rule.Core.EvaluationScope
Gets or sets the value that specifies how to treat multiple rules in a ruleset when they are evaluated in one step using the Ruleset mode. The default value is EvaluationScope.All. See remarks below for additional info.
-
ShortCircuit Type: System.Boolean
Gets or sets the value indicating whether to stop further evaluation of a rule immediatelly after the result is determined. The default value is True. See remarks below for additional info.
Remarks
The ShortCircuit parameter does not apply to individual statements, only to rules themselves and works in conjunction with the Scope parameter.
To illustrate this, suppose you have three rules A, B, and C as a part of a single ruleset. Then the following table represents possible states:
Scope |
ShortCircuit |
Expression |
|
All |
True |
A short-and B short-and C |
Rules are evaluated sequentially applying logical AND operator. Evaluation stops as soon as one rule returns False. |
All |
False |
A and B and C |
All rules are evaluated and results are combined using logical AND. |
AtLeastOne |
True |
A short-or B short-or C |
Rules are evaluated sequentially applying logical OR operator. Evaluation stops as soon as one rule returns True. |
AtLeastOne |
False |
A or B or C |
All rules are evaluated and results are combined using logical OR. |
Individual rules are still evaluated using short-circuit logic.
This behavior applies in two cases:
- Evaluating multiple rules at once as a part of a larger ruleset. Call the Evaluator.Evaluate(TSource, EvaluationScope, bool) overload.
- Evaluating a single rule that contains multiple IF statements. Pass settings in the EvaluationParameters parameter of the Evaluator constructor.