Class CompiledRule<T>
Represents a compiled rule that can be evaluated at runtime.
public sealed class CompiledRule<T> where T : class
Type Parameters
TThe type this rule applies to.
- Inheritance
-
CompiledRule<T>
- Inherited Members
Constructors
CompiledRule(RuleManifest, Func<T, bool>)
Initializes a new instance of the CompiledRule<T> class.
public CompiledRule(RuleManifest manifest, Func<T, bool> predicate)
Parameters
manifestRuleManifestThe rule manifest.
predicateFunc<T, bool>The compiled predicate.
Properties
Manifest
Gets the rule manifest containing metadata about the rule.
public RuleManifest Manifest { get; }
Property Value
Predicate
Gets the compiled predicate that evaluates the rule.
public Func<T, bool> Predicate { get; }
Property Value
Methods
Evaluate(T)
Evaluates the rule against the specified instance.
public bool Evaluate(T instance)
Parameters
instanceTThe instance to evaluate.
Returns
- bool
True if the rule passes; otherwise, false.