rules-framework
rules-framework copied to clipboard
Rename content type to ruleset
Description
Renames content type to ruleset and condition type to condition:
-
TContentType
generic references renamed toTRuleset
. -
TConditionType
generic references renamed toTCondition
. - Method names referencing content type concept renamed to refer to the ruleset concept.
- Method names referencing condition type concept renamed to refer to the condition concept.
- Parameter names fixed to refer to new concepts.
[!NOTE] The concept of
Ruleset
is introduced to replace the content type concept. Functionally, it works the same way, but presents a simpler concept to new library users: a ruleset is a collection of related rules which are managed and evaluated together.
[!WARNING] BREAKING CHANGE: the rule builder API was refactored to align with the Rule Query Language specification (being developed on a separate branch).
Take as example the RQL sentence:
create rule "Test rule" on ruleset "TexasHoldemPokerSingleCombinations" set content "{\"BasePoints\":0,\"Combination\":\"Test combination\"}" since $2023-01-01Z$ until $2023-12-31Z$ apply when @NumberOfAces >= 5 set priority top;
It would be written on rule builder API as:
var rule = Rule.Create("Test rule") .OnRuleset("TexasHoldemPokerSingleCombinations") .SetContent("{\"BasePoints\":0,\"Combination\":\"Test combination\"}") .Since(DateTime.Parse("2023-01-01Z")) .Until(DateTime.Parse("2023-12-31Z")) .ApplyWhen("NumberOfAces", Operators.GreaterOrEqualThan, 5) .Build().Rule; var operationResult = await rulesEngine.AddRuleAsync(rule, RuleAddPriorityOption.AtTop);
Change checklist
- [ ] Code follows the code rules guidelines of this project
- [ ] Commit messages follow the commit rules of this project
- [ ] I have self-reviewed my changes before submitting this pull request
- [ ] I have covered new/changed code with new tests and/or adjusted existent ones
- [ ] I have made changes necessary to update the documentation accordingly
Please also check the I want to contribute guidelines and make sure you have done accordingly.
Disclaimer
By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement