diff --git a/bindings/uniffi/nuget/GoRules.ZenEngine.csproj b/bindings/uniffi/nuget/GoRules.ZenEngine.csproj index 5c7be94f..9698645c 100644 --- a/bindings/uniffi/nuget/GoRules.ZenEngine.csproj +++ b/bindings/uniffi/nuget/GoRules.ZenEngine.csproj @@ -4,9 +4,11 @@ net8.0 GoRules.ZenEngine GoRules + GoRules ZEN Engine - Business Rules Engine for .NET. Execute JSON Decision Models (JDM) with native performance via Rust FFI bindings. MIT https://github.com/gorules/zen + icon.png https://github.com/gorules/zen rules-engine;business-rules;decision-engine;jdm;gorules enable @@ -19,6 +21,7 @@ + diff --git a/bindings/uniffi/nuget/README.md b/bindings/uniffi/nuget/README.md index 1440bb75..2fd72fd9 100644 --- a/bindings/uniffi/nuget/README.md +++ b/bindings/uniffi/nuget/README.md @@ -13,6 +13,12 @@ dotnet add package GoRules.ZenEngine ```csharp using GoRules.ZenEngine; +// Create engine and evaluate +var engine = new ZenEngine(loader: new FileLoader(), customNode: null); +var context = new JsonBuffer("{\"input\": 42}"); +var response = await engine.Evaluate("my-decision.json", context, null); +Console.WriteLine(response.result.ToString()); + // Implement a loader to resolve decision files class FileLoader : ZenDecisionLoaderCallback { @@ -22,12 +28,6 @@ class FileLoader : ZenDecisionLoaderCallback return Task.FromResult(new JsonBuffer(bytes)); } } - -// Create engine and evaluate -var engine = new ZenEngine(loader: new FileLoader(), customNode: null); -var context = new JsonBuffer("{\"input\": 42}"); -var response = await engine.Evaluate("my-decision.json", context, null); -Console.WriteLine(response.result.ToString()); ``` ## Features @@ -66,6 +66,7 @@ var result = ZenUniffiMethods.EvaluateExpression( // Compiled expression (reusable, better performance) var expr = ZenExpression.Compile("a + b * 2"); var output = expr.Evaluate(new JsonBuffer("{\"a\": 1, \"b\": 10}")); +Console.WriteLine($"output: {output}"); expr.Dispose(); ``` @@ -92,5 +93,5 @@ var engine = new ZenEngine(loader: new FileLoader(), customNode: new MyCustomNod ## Links - [GitHub Repository](https://github.com/gorules/zen) -- [GoRules Documentation](https://gorules.io/docs) +- [GoRules Documentation](https://gorules.mintlify.app/developers/sdks/csharp) - [JDM Editor](https://editor.gorules.io) diff --git a/bindings/uniffi/nuget/icon.png b/bindings/uniffi/nuget/icon.png new file mode 100644 index 00000000..b3199c44 Binary files /dev/null and b/bindings/uniffi/nuget/icon.png differ