CanDoItAll.Ledger.Rules.NCalc 0.1.18

dotnet add package CanDoItAll.Ledger.Rules.NCalc --version 0.1.18
                    
NuGet\Install-Package CanDoItAll.Ledger.Rules.NCalc -Version 0.1.18
                    
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="CanDoItAll.Ledger.Rules.NCalc" Version="0.1.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CanDoItAll.Ledger.Rules.NCalc" Version="0.1.18" />
                    
Directory.Packages.props
<PackageReference Include="CanDoItAll.Ledger.Rules.NCalc" />
                    
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 CanDoItAll.Ledger.Rules.NCalc --version 0.1.18
                    
#r "nuget: CanDoItAll.Ledger.Rules.NCalc, 0.1.18"
                    
#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 CanDoItAll.Ledger.Rules.NCalc@0.1.18
                    
#: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=CanDoItAll.Ledger.Rules.NCalc&version=0.1.18
                    
Install as a Cake Addin
#tool nuget:?package=CanDoItAll.Ledger.Rules.NCalc&version=0.1.18
                    
Install as a Cake Tool

CanDoItAll.Ledger.Rules.NCalc

Invariant-culture NCalc adapter for CanDoItAll Ledger account-rule expressions.

Use this package when account or transaction workflows need numeric or boolean expressions behind the IAccountRuleExpressionEvaluator abstraction. NCalc types and exceptions remain isolated inside the adapter.

Requirements

  • .NET 10

Install

dotnet add package CanDoItAll.Ledger.Rules.NCalc

Evaluate A Budget Rule

using CanDoItAll.Ledger.Rules.NCalc;

var evaluator = new NCalcAccountRuleExpressionEvaluator();
var variables = new Dictionary<string, object?>(StringComparer.Ordinal)
{
    ["spent"] = 72.50m,
    ["budget"] = 100m
};

var result = evaluator.EvaluateBoolean(
    "spent <= budget",
    variables);

if (!result.Succeeded)
{
    throw new InvalidOperationException(result.Error);
}

Register

using CanDoItAll.Ledger.Rules.NCalc;

builder.Services.AddNCalcAccountRuleExpressionDriver();

This supplies IAccountRuleExpressionEvaluator unless the application already registered another implementation.

Evaluation Notes

  • Numbers and numeric strings use invariant culture.
  • Parse and evaluation failures return Succeeded == false with an error message. Do not consume Value before checking the result.
  • The adapter supports boolean and decimal result contracts; application code should keep rule variables explicit and typed.
  • The package does not impose a time limit or expression-complexity quota. Bound the size and complexity of untrusted expressions before evaluation.
  • Rule evaluation is one policy input. Node authorization and complete transaction validation still determine acceptance.

See the BusinessObjects package, SDK, and full source.

This package is part of the CanDoItAll ecosystem and uses the repository's MIT License.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CanDoItAll.Ledger.Rules.NCalc:

Package Downloads
CanDoItAll.Ledger.Sdk

Typed node client and dependency-injection integration for CanDoItAll Ledger account and transaction workflows.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.18 20 7/31/2026
0.1.17 40 7/30/2026