All notable changes to this project will be documented in this file.
IRulesEngine.ExecuteAllRulesAsyncgains an overload accepting aCancellationToken, observed cooperatively between rules and before each action. The existingparams object[]andparams RuleParameter[]overloads are unchanged; call-site overload resolution continues to pick them when no token is supplied (#609).- New
ReSettings.AutoExecuteActions(defaulttrue). Set tofalseto evaluate rules without automatically running their OnSuccess/OnFailure actions, so callers can run actions selectively viaExecuteActionWorkflowAsync(#596). - Documented and tested passing computed
additionalInputsinto theEvaluateRuleaction — the additionalInputNameis referenced directly in the target rule's expression (#573).
Utils.CreateAbstractClassType/CreateObjectnow unwrapSystem.Text.Json.JsonElementscalar values to their native CLR types (string / int / long / double / bool / null) when building typed objects fromExpandoObjectinputs. This restores the pre-System.Text.Json behavior for rule expressions likeinput1.country == "india"that previously failed with "binary operator Equal is not defined for the types 'JsonElement' and 'String'" (#668).
- Removed the obsolete
ErrorTypefield from JSON examples inREADME.md,docs/Getting-Started.md, anddocs/index.md.ErrorTypewas removed from theRulemodel in 4.0.0 (#676).
- #692 — Nullable
DateTimecomparisons againstnull(null < someDate/null > someDate) returnfalse, matching standard C#Nullable<T>semantics. Test documents the recommendedHasValueworkaround for users who want null-aware ordering.
- Restored the compiled-expression cache in
RuleExpressionParserthat was removed in 5.0.1, fixing a 10×–1900× regression on the direct parser,ExecuteActionWorkflowAsync, and fresh-engine paths. The cache is now instance-scoped with a settings fingerprint in the key, avoiding the latent cross-settings bug the original static cache had (#673, #727).
EnableExceptionAsErrorMessage = falsenow correctly propagates exceptions thrown from custom actions'Run()— they were previously swallowed intoActionRuleResult.Exception(#624, #728).Utils.CreateAbstractClassTypenow unions schemas across every element of anExpandoObject/Dictionarylist, so properties that appear only in later elements are no longer dropped (#704, #728).OutputExpressionActiondetects C#-style anonymous-object syntax (new { X = ... }) and replaces the cryptic "missing 'as' clause" Dynamic.Core error with a clear hint pointing at the correctnew (value as X, ...)form (#711, #728).- Workflow
GlobalParamsare now evaluated once perExecuteAllRulesAsynccall instead of once per rule. A delegate is compiled at registration time and results are appended to each rule's inputs (#714, #728). LambdaExpressionBuilderdetects "exists in type 'Object'" / "'System.Object'" parse errors and appends a helpful hint when a custom method'sobjectreturn type is the cause (#717, #728).ExecuteActionWorkflowAsyncnow runsFormatErrorMessageslikeExecuteAllRulesAsyncdoes, soRule.ErrorMessagetemplates are interpolated intoExceptionMessageconsistently across both APIs (#519, #729).ActionContextno longer NREs when a rule action'sContext(or a nested value) is null — common for custom actions that don't need configuration (#576, #729).ErrorMessageinterpolation now walks arbitrary-depth dotted paths viaJsonNode:$(input.Inner.Name)resolves to the leaf scalar instead of the raw JSON of the intermediate object (#696, #729).
- #581 — custom
RuleParameternames not being honored (resolved byAutoRegisterInputTypein 5.0.1). - #590 — exception state from one execution leaking into the next (resolved by #592 in 5.0.3).
- #606 — lambda parameter on the left side of
=>reported as unknown identifier (resolved bySystem.Linq.Dynamic.Core1.4.3 → 1.6.7 bumps). - #608 —
UseFastExpressionCompiler = trueNRE on chained scoped-paramSum()(resolved by recentFastExpressionCompilerupgrades).
- Updated dependencies to latest
- Fixed RulesEngine throwing exception when type name is same as input name
- Added config to disable FastCompile for expressions
- Added RuleParameter.Create method for better handling on types when value is null
- Fixed Scoped Params returning incorrect results in some corner case scenarios
- Added option to disable automatic type registry for input parameters in reSettings
- Added option to make expression case sensitive in reSettings
- Fixed security bug related to System.Dynamic.Linq.Core
- As a part of security bug fix, method call for only registered types via reSettings will be allowed. This only impacts strongly typed inputs and nested types
- RulesEngine is now available in both dotnet 6 and netstandard 2.0
- Dependency on ILogger, MemoryCache have been removed
- Obsolete Properties and Methods have been removed
- Fixed name of RuleParameter is ignored if the type is recognized (by @peeveen)
- ILogger has been removed from RulesEngine and all its constructors
- RulesEngine(string[] jsonConfig, ILogger logger = null, ReSettings reSettings = null)
+ RulesEngine(string[] jsonConfig, ReSettings reSettings = null)
- RulesEngine(Workflow[] Workflows, ILogger logger = null, ReSettings reSettings = null)
+ RulesEngine(Workflow[] Workflows, ReSettings reSettings = null)
- RulesEngine(ILogger logger = null, ReSettings reSettings = null)
+ RulesEngine(ReSettings reSettings = null)- Obsolete methods and properties have been removed, from the follow models:-
-
RuleResultTree
ToResultTreeMessages()has been removed fromRuleResultTreemodelGetMessages()has been removed fromRuleResultTreemodelRuleEvaluatedParamshas been removed fromRuleResultTreemodel, Please useInputsinstead
-
Workflow
WorkflowRulesToInjecthas been removed, Please useWorkflowsToInjectinsteadErrorTypehas been removed fromRule
-
Resettings
EnableLocalParamshas been removed fromReSettings, Please useEnableScopedParamsinstead
-
EvaluateRuleaction now support custom inputs and filtered inputs- Added
ContainsWorkflowmethod in RulesEngine (by @okolobaxa) - Fixed minor bugs (#258 & #259)
-
Made RulesEngine Strong Name and Authenticode signed
-
Renamed few models to streamline names (by @alexrich)
WorkflowRulesis renamed toWorkflowWorkflowRulesToInjectis renamed toWorkflowsToInjectRuleActionis renamed toRuleActions
Note: The old models are still supported but will be removed with version 4.0.0
- Added support for actions in nested rules
- Improved serialization support for System.Text.Json for workflow model
Breaking Change:
- Type of Action has been changed from
Dictionary<ActionTriggerType, ActionInfo>toRuleActions- No impact if you are serializing workflow from json
- For workflow objects created in code, refer - link
- Added AddOrUpdateWorkflow method to update workflows atomically (by @AshishPrasad)
- Updated dependencies to latest
Breaking Change:
AddWorkflownow throws exception if you try to add a workflow which already exists. UseAddOrUpdateWorkflowto update existing workflow
- Added globalParams feature which can be applied to all rules
- Enabled localParams support for nested Rules
- Made certain fields in Rule model optional allowing users to define workflow with minimal fields
- Added option to disable Rule in workflow json
- Added
GetAllRegisteredWorkflowto RulesEngine to return all registered workflows - Runtime errors for expressions will now be logged as errorMessage instead of throwing Exceptions by default
- Fixed RuleParameter passed as null
- Fixed LocalParams cache not getting cleaned up when RemoveWorkflows and ClearWorkflows are called
- Moved ActionResult and ActionRuleResult under RulesEngine.Models namespace
- Added support for Actions. More details on actions wiki
- Major performance improvement
- 25% improvement from previous version
- Upto 35% improvement by disabling optional features
- RulesEngine now virtually supports unlimited inputs (Previous limitation was 16 inputs)
- RuleExpressionParser is now available to use expression evaluation outside RulesEngine
ExecuteRulemethod has been renamed toExecuteAllRulesAsyncInputfield in RuleResultTree has been changed toInputswhich returns all the the inputs as Dictionary of name and value pair
- Added
Propertiesfield to Rule to allow custom fields to Rule
- Added exception data properties to identify RuleName.
- Optional parameter for rethrow exception on failure of expression compilation.
- Fixed binary expression requirement. Now any expression will work as long as it evalutes to boolean.
- Fixed exception thrown when errormessage field is null
- Added better messaging when identifier is not found in expression
- Fixed other minor bugs
- Adding local param support to make expression authroing more intuitive.
- Interface simplified by removing redundant parameters in the IRulesEngine.
- Custom Logger replaced with Microsoft Logger.
- Cache system added so that rules compilation is stored and thus made more efficient.
- Concurrency issue which arose by dictionary was resolved.
- Exceptions handling scenario in the case a rule execution throws an exception
- The first version of the NuGet