Nodora 0.2.5

dotnet add package Nodora --version 0.2.5
                    
NuGet\Install-Package Nodora -Version 0.2.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nodora" Version="0.2.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nodora" Version="0.2.5" />
                    
Directory.Packages.props
<PackageReference Include="Nodora" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nodora --version 0.2.5
                    
#r "nuget: Nodora, 0.2.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nodora@0.2.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nodora&version=0.2.5
                    
Install as a Cake Addin
#tool nuget:?package=Nodora&version=0.2.5
                    
Install as a Cake Tool

nodora-dotnet

.NET bindings for the Nodora rule engine.

Install

dotnet add package Nodora

The package targets netstandard2.0, so it works on .NET Framework 4.6.1+, .NET Core, and .NET 5/6/7/8+.

Prebuilt runtimes

The native engine ships inside the package under runtimes/<rid>/native and is loaded automatically at run time. Prebuilt for:

RID
linux-x64
linux-arm64
osx-x64
osx-arm64
win-x64

Other platforms build from source (needs Go 1.24+ with cgo) — see Development.

Usage

using NodoraEngine;

var ruleset = Nodora.Compile(@"
    rule AdultCheck {
        out is_adult = input.age >= 18
    }
");

using var evaluator = ruleset.CreateEvaluator();
var result = evaluator.Evaluate("AdultCheck", new { age = 21 });

Console.WriteLine(result.Outputs["is_adult"].GetBoolean()); // True

Evaluate takes any object; it is serialized to JSON with System.Text.Json and becomes the rule's input. Outputs are returned as JsonElement values you read with the usual accessors (GetBoolean(), GetInt32(), GetString(), …).

Signals emitted by a rule are returned in the result. You can read the raw list directly:

foreach (var signal in result.EmittedSignals)
{
    Console.WriteLine($"{signal.Name}({string.Join(", ", signal.Args)})");
}

Or subscribe listeners to specific signals with a SignalDispatcher, so you don't have to switch over each signal by name:

var signals = new SignalDispatcher();
signals.On("Greet", s => Console.WriteLine($"Greetings, {s.Arg<string>(0)}!"));
signals.OnAny(s => logger.Debug($"signal {s.Name}"));  // catch-all

var result = evaluator.Evaluate("AdultCheck", new { age = 21, name = "Alice" });
signals.Dispatch(result);

On and OnAny return an IDisposable you can dispose to unsubscribe. Arg<T>(index) deserializes a positional argument to the type you expect.

Dispatch is synchronous: the decision (rule outputs) is already returned before you dispatch, so keep handlers fast. For a slow or best-effort effect such as sending an email, have the handler hand the work off to a queue or outbox and return, rather than blocking in the handler.

A precompiled ruleset (e.g. the output of nodora compile) can be loaded without recompiling the source:

var ruleset = Nodora.FromJson(rulesetJson);

The evaluator owns a native handle — dispose it (a using statement is the easiest way) when you are done. A single evaluator can be reused across many inputs.

API

Member Purpose
Nodora.Compile(source) Compile Nodora source to a ruleset.
Nodora.FromJson(json) Load a precompiled ruleset.
Ruleset.ToJson() Serialize the ruleset back to JSON.
Ruleset.CreateEvaluator() Build a reusable evaluator.
Evaluator.Evaluate(rule, input) Run a rule against any serializable input.
Evaluator.EvaluateJson(rule, json) Run a rule against a raw JSON input.
EvaluationResult { Outputs, EmittedSignals } Named outputs and emitted signals.
SignalDispatcher Route emitted signals to named listeners.
NodoraException Thrown on compile/evaluation errors.

Development

The managed library builds without the native engine, but running tests or the example requires it. Building the engine needs a Go 1.24+ toolchain with cgo (a working C compiler):

make native    # build the native engine into runtimes/<host-rid>/native
make test      # build the engine, then run the test suite
make example   # run the example

On Windows, make native runs build/build-native.ps1; you can also run that script directly. It requires a MinGW-w64 gcc on PATH for cgo.

To produce the NuGet package locally (with whatever runtimes you have built):

make pack      # -> dist/Nodora.<version>.nupkg

CI (.github/workflows/build.yml) builds the native engine for every supported RID and packs them all into a single cross-platform package on tag pushes.

License

Apache-2.0.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.5 95 9/2/2026
0.2.4 137 7/5/2026
0.2.3 114 7/5/2026
0.2.2 129 7/5/2026