Upgrade guide
This guide lists what changed between major versions and what you need to do. The complete history is in the change log.
To 6.x
No breaking API changes. Behavior you may notice:
- The compiled-expression cache is back (it was removed in 5.0.1), which speeds up many paths dramatically.
- Workflow
GlobalParamsare evaluated once perExecuteAllRulesAsynccall, not once per rule. - Duplicate
GlobalParamsorLocalParamsnames are rejected when the workflow is added, and an input with the same name as a global parameter is reported as a rule error. EnableExceptionAsErrorMessage = falsenow also rethrows exceptions raised by custom actions.ExecuteActionWorkflowAsyncformatsErrorMessagetemplates likeExecuteAllRulesAsyncdoes.- New settings:
EnableAssemblyScanning,AutoExecuteActionsandEnableParallelRuleCompilation, and anExecuteAllRulesAsyncoverload that takes aCancellationToken.
From 4.x to 5.0
Breaking: expressions can call methods and use static members only on registered types. This fixed a security issue in System.Linq.Dynamic.Core.
What to do:
- Add the types your rules call to
ReSettings.CustomTypes. - Input types are registered automatically (
AutoRegisterInputType, added in 5.0.1). Strongly typed inputs and nested types that your rules call methods on may need explicit registration if you turned that setting off.
See the type security model.
From 3.x to 4.0
Breaking:
ILoggerwas removed from every constructor. Changenew RulesEngine(workflows, logger, reSettings)tonew RulesEngine(workflows, reSettings).- Obsolete members were removed:
RuleResultTree.ToResultTreeMessages()andGetMessages();RuleResultTree.RuleEvaluatedParams(useInputs);Rule.ErrorType;ReSettings.EnableLocalParams(useEnableScopedParams).
- The 3.4 legacy names (
WorkflowRules,WorkflowRulesToInject,RuleAction) still exist in 6.x, marked[Obsolete]. Move toWorkflow,WorkflowsToInjectandRuleActions. - The library targets .NET 6 and .NET Standard 2.0 and no longer depends on
Microsoft.Extensions.LoggingorMemoryCache.
From 2.x to 3.x
Breaking:
ExecuteRulewas renamedExecuteAllRulesAsync, and it is asynchronous.RuleResultTree.InputbecameInputs, a dictionary of all input names and values.- (3.2)
AddWorkflowthrows if the workflow name already exists. UseAddOrUpdateWorkflowto replace it. - (3.3)
Rule.Actionschanged fromDictionary<ActionTriggerType, ActionInfo>toRuleActionswithOnSuccessandOnFailure. JSON files are not affected; workflows built in code need updating. - (3.4) Types were renamed:
WorkflowRulestoWorkflow,WorkflowRulesToInjecttoWorkflowsToInject,RuleActiontoRuleActions. The old names were kept as obsolete aliases.
Check after upgrading
- Run your rules with representative inputs and compare the
IsSuccessandExceptionMessageof each result with the previous version. - Look for
Exception while parsing expressionmessages: a call on a type that is no longer registered shows up there. - Warm up and time your largest workflows. See Performance.