Choose your packages
Install RuleWright and you have everything most applications need. The other packages exist so that a library, or an app that already uses Newtonsoft.Json, can take exactly the pieces it wants.
The main package
RuleWright is a metapackage. It contains no code of its own, only references to these five:
Included in RuleWright |
What it provides |
|---|---|
RuleWright.Core |
The domain model: Rule, RuleSet, conditions, value expressions, EvaluationOptions, results and traces, and IRuleFunction. Zero dependencies. |
RuleWright.Serialization |
Parsing, validation with JSON-pointer errors, decision-table expansion, the canonical content hash and the RuleSchemaCatalog. It defines IRuleJsonReader but depends on no JSON library. |
RuleWright.Execution |
RuleWrightBuilder and RuleWrightEngine: the expression-tree compiler, the dictionary interpreter and the compiled-delegate cache. |
RuleWright.Json.SystemText |
SystemTextJsonReader, and SystemTextJsonFacts to turn a JsonElement into a dictionary fact. |
RuleWright.Extensions.Functions |
The fifteen built-in functions for the custom operator, and RegisterFunctionsFrom assembly scanning. |
Pick the pieces instead
Reference RuleWright.Execution plus one JSON adapter:
dotnet add package RuleWright.Execution
dotnet add package RuleWright.Json.NewtonsoftJson # or RuleWright.Json.SystemText
dotnet add package RuleWright.Extensions.Functions # only if you want the built-in functions
| Package | Install it to… |
|---|---|
RuleWright.Json.NewtonsoftJson |
Read rule documents with Newtonsoft.Json instead of System.Text.Json. It is the one package not in the metapackage. See JSON adapters. |
RuleWright.Serialization alone |
Validate or hash rule documents without being able to run them, for example in an editor back end or a build step. |
RuleWright.Core alone |
Share rule and result types between projects without taking the engine. |
Tip
An engine built without a JSON reader still works: it evaluates rule sets you build in C#. The reader is only needed by the overloads that take JSON text.
Target frameworks
Every package targets .NET Framework 4.8, .NET Standard 2.0, .NET 8.0 and .NET 10.0, is strong-named, and ships symbols with Source Link. The .NET Framework 4.8 leg is tested, and a .NET Framework sample runs in CI.
| net48 | netstandard2.0 | net8.0 | net10.0 | |
|---|---|---|---|---|
| Core, Serialization, Execution, Functions | ✓ | ✓ | ✓ | ✓ |
| Json.SystemText | ✓ (System.Text.Json package) | ✓ (System.Text.Json package) | ✓ (in-box) | ✓ (in-box) |
| Json.NewtonsoftJson | ✓ | ✓ | ✓ | ✓ |
Note
Native AOT and trimming are not supported for compiled rules. Compilation is runtime code generation (System.Linq.Expressions). Under Native AOT, evaluate dictionary facts: they take the interpreter, and result.CompilationMode reports Interpreted.
Next
Install the package.