Class RuleWrightEngine
- Namespace
- RuleWright.Execution
- Assembly
- RuleWright.Execution.dll
The RuleWright evaluation engine: loads rule sets (parse → validate → prepare), compiles rules to delegates per fact type via expression trees, caches the compiled delegates by rule content hash, and evaluates facts against them. Thread-safe: one engine instance can serve concurrent evaluations.
Build one with RuleWrightBuilder, which also carries the
MatchesRegex match timeout — see UseRegexTimeout(TimeSpan).
public sealed class RuleWrightEngine
- Inheritance
-
RuleWrightEngine
- Inherited Members
Properties
- FunctionCatalog
Discovery metadata for the
customfunctions registered on this engine, in the same order as RegisteredFunctions. Functions that don't implement IRuleFunctionMetadata appear with a null description and Unspecified.
- RegisteredActions
The names of the custom action types registered on this engine, sorted ordinally. A rule document may use these in addition to the built-in action types listed in ActionTypes.
- RegisteredFunctions
The names of the
customfunctions registered on this engine, sorted ordinally. Together with the built-in vocabulary in RuleSchemaCatalog, this is the full set of authoring choices a rule-builder UI can offer against this engine — the one part of the vocabulary that varies per configuration.
- RegisteredValueFunctions
The names of the
callvalue functions registered on this engine, sorted ordinally.
- ValueFunctionCatalog
Discovery metadata for the
callvalue functions registered on this engine, in the same order as RegisteredValueFunctions. Functions that don't implement IRuleValueFunctionMetadata appear with a null description and no declared operand count.
Methods
- Evaluate<TFact>(LoadedRuleSet, TFact, EvaluationOptions?)
Evaluates a fact against a loaded rule set. Typed facts run compiled delegates (cached per fact type and rule content hash); dictionary facts (
IDictionary<string, object>) run the interpreter, reported via CompilationMode.
- LoadRuleSet(RuleSet)
Prepares an already-constructed domain RuleSet for evaluation, bypassing JSON entirely.
- LoadRuleSet(string)
Parses, validates, and prepares a JSON rule document (a single rule or a rule set) for evaluation. Parsing and validation happen exactly once here; per-fact-type compilation happens lazily on first evaluation and is cached by rule content hash.
- Validate(string)
Validates JSON against the RuleWright schema contract without loading it, returning structured errors with JSON pointer paths. Malformed JSON is reported as a single root-level error rather than an exception, making this directly bindable from editor/UI validation.