TracerDelegate Delegate
Assembly: CodeEffects.Rule.Common.dll
Namespace: CodeEffects.Rule.Common.Models
Summary
Enables runtime tracing of rule evaluation. It is assigned to the EvaluationParameters.Tracer property and is invoked by the Evaluator whenever it evaluates an expression in a rule.
Syntax
using System.Linq.Expressions;
using System.Xml.Linq;
public delegate void TracerDelegate(object source, Expression expression, object result, XElement element);
Parameters
source
Type: System.Object
The current reference to the original source object passed to the evaluator. This is the same object instance used throughout rule evaluation. For execution type rules, any setters or actions executed by the rule can modify this object, allowing your tracer implementation to inspect its current state at every trace point.
expression
Type: System.Linq.Expressions.Expression
The .NET Expression instance that has just been evaluated.
result
Type: System.Object
The value produced by the evaluated expression.
element
Type: System.Xml.Linq.XElement
The original RuleXML node that represents the expression being evaluated. This parameter provides direct access to the XML element from which the expression was compiled, making it easy to identify the corresponding rule element during debugging or logging.
Returns
Type: System.Void
Remarks
The evaluator invokes the delegate every time it evaluates a traceable expression during rule execution. Because the delegate executes as part of the evaluation process, implementations should avoid long-running or resource-intensive operations unless required by the application.
See the Using the Code Effects Rule Tracer article for implementation details.