EvaluationParameters Class

Assembly: CodeEffects.Rule.Common.dll
Namespace: CodeEffects.Rule.Common.Models

Summary

Represents a parameter object used by the rule evaluator classes during rule evaluation.

Syntax

public class EvaluationParameters

Properties

  • AssemblyWhitelist

    Type: ICollection<System.String>

    Gets or sets the collection of trusted assembly names that are allowed to participate in rule evaluation. When specified, the evaluator only allows fields, properties, methods, and actions declared in the listed assemblies to be accessed or invoked. This property is optional. See the main Assembly Whitelisting article for details.

  • LINQProviderType

    Type: CodeEffects.Rule.Common.Models.LinqProviderType

    Gets or sets the type of LINQ provider used when Code Effects builds expression trees during data filtering operations. The Default value indicates that the engine will attempt to detect the LINQ provider type automatically. Use SQL for LINQ-to-SQL providers and Entities for LINQ-to-Entities. This enumeration exists because various providers handle string operations differently, and in most cases it is difficult to automatically determine the behavior of the current provider. Theoretically, any LINQ provider is supported as long as it implements the same set of commands as LINQ-to-SQL.

  • MaxIterations

    Type: System.Int32

    Gets or sets the maximum number of iterations allowed before the evaluation fails in Loop mode. A value of -1 indicates no limit.

  • MidpointRounding

    Type: System.MidpointRounding

    Gets or sets the rounding algorithm. The default value is System.MidpointRounding.ToEven, also known as round to even or banker’s rounding. This is the default .NET rounding algorithm. For traditional rounding, set this property to MidpointRounding.AwayFromZero. Rounding is applied only in comparison operators using the Math.Round() method. Set the value of Precision property to -1 to disable rounding.

  • PerformNullChecks

    Type: System.Boolean

    Gets or sets a value indicating whether the engine includes null-pointer safety checks in the compiled code to prevent run-time exceptions. The default value is true.

  • Precision

    Type: System.Int32

    Gets or sets the number of fractional digits to which decimal or double values are rounded. Rounding is applied only in comparison operators using the Math.Round() method. A value of -1 disables rounding.

  • PreserveWhitespace

    Type: System.Boolean

    Gets or sets a value indicating whether the rule editor preserves white spaces in string values in the Rule XML during rule generation. By default, the rule editor trims all string values and reduces consecutive white spaces to a single space. For example, if this property is set to false, the string value " My name is John " is saved in the Rule XML as "My name is John". The default value is false.

  • RuleID

    Type: System.String

    Gets or sets the ID of the rule to be evaluated or compiled. This property is optional.

  • RuleResolver

    Type: CodeEffects.Rule.Core.GetRuleDelegate

    Delegate used to request missing rules — rules that are referenced but not included in the current rule set. This property is optional.

    Remarks

    In some cases, such as rules that use reference-typed collections and arrays, the Rule Editor creates separate rule nodes in RuleXML for each referenced collection because its ElementType is essentially another source object for the rule. Those rule nodes are included in the resulting RuleXML of the main rule, so the RuleResolver delegate is not needed in that scenario.

    However, if, for instance, you use the reusable rules feature and do not manually add to the main Rule XML all reusable rules referenced by the main rule before loading it into the editor, you need a RuleResolver delegate. The editor calls this delegate whenever it needs a referenced reusable rule, allowing your code to query rule storage and return the requested rule.

  • Scope

    Type: CodeEffects.Rule.Core.EvaluationScope

    Gets or sets a value that specifies how to treat multiple rules in a rule set when they are evaluated in a single step using the Ruleset mode. The default value is EvaluationScope.All. See Remarks for additional details.

  • ShortCircuit

    Type: System.Boolean

    Gets or sets a value indicating whether to stop further evaluation of a rule immediately after its result has been determined. The default value is true.

    Remarks

    The ShortCircuit parameter applies only to entire rules, not to individual statements, and operates in conjunction with the Scope parameter.

    To illustrate, consider a ruleset containing three rules — A, B, and C. The following table demonstrates the possible evaluation states:

    Scope ShortCircuit Expression Details
    All True A short-and B short-and C Rules are evaluated sequentially using the logical `AND` operator. The evaluation process stops immediately when any rule returns `false`.
    All False A and B and C All rules are evaluated, and their results are combined using the logical `AND` operator.
    AtLeastOne True A short-or B short-or C Rules are evaluated sequentially using the logical `OR` operator. The evaluation process stops immediately when any rule returns `true`.
    AtLeastOne False A or B or C All rules are evaluated, and their results are combined using the logical `OR` operator.

    Individual rules are still evaluated using short-circuit logic internally.

    This behavior applies in two scenarios:

    • When evaluating multiple rules as part of a larger ruleset — call the Evaluator.Evaluate(TSource, EvaluationScope, bool) overload.
    • When evaluating a single rule that contains multiple if statements in Ruleset mode — pass the desired settings in the EvaluationParameters param of the Evaluator constructor.
  • Tracer

    Type: CodeEffects.Rule.Common.Models.TracerDelegate

    Gets or sets the TraceDelegate instance used by the evaluator to trace rule execution. When assigned, the evaluator invokes this delegate during rule evaluation, allowing your code to inspect expressions, evaluation results, and the corresponding RuleXML elements for debugging, logging, or diagnostics. This property is optional. See the main Debugging and Logging article for details.

  • TypeResolver

    Type: CodeEffects.Rule.Core.GetRuleDelegate

    Gets or sets the delegate used to resolve .NET types by their assembly-qualified or alias names during rule evaluation. Assign this property when your application uses custom type aliases or requires custom type resolution logic. This property is optional. See the main Type Handling and Aliasing article for details.

p102

l097 --

l102

p101

×