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
<PackageReference Include="CanDoItAll.Ledger.Rules.NCalc" Version="0.1.18" />
<PackageVersion Include="CanDoItAll.Ledger.Rules.NCalc" Version="0.1.18" />
<PackageReference Include="CanDoItAll.Ledger.Rules.NCalc" />
paket add CanDoItAll.Ledger.Rules.NCalc --version 0.1.18
#r "nuget: CanDoItAll.Ledger.Rules.NCalc, 0.1.18"
#:package CanDoItAll.Ledger.Rules.NCalc@0.1.18
#addin nuget:?package=CanDoItAll.Ledger.Rules.NCalc&version=0.1.18
#tool nuget:?package=CanDoItAll.Ledger.Rules.NCalc&version=0.1.18
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 == falsewith an error message. Do not consumeValuebefore 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 | Versions 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. |
-
net10.0
- CanDoItAll.Ledger.BusinessObjects (>= 0.1.18)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- NCalc (>= 6.4.0)
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.