Rule based filtering using expression trees.
Go to file
Sean McArde 1365ba544e TEST BROKEN - working on EF string comparisons. 2023-09-02 11:30:15 -07:00
.github/workflows Create dotnet-library.yml 2023-07-24 14:23:56 -07:00
.idea Adding jetbrains specific files. 2023-03-13 18:10:31 -07:00
McRule TEST BROKEN - working on EF string comparisons. 2023-09-02 11:30:15 -07:00
McRule.EF TEST BROKEN - working on EF string comparisons. 2023-09-02 11:30:15 -07:00
McRule.Tests TEST BROKEN - working on EF string comparisons. 2023-09-02 11:30:15 -07:00
RulerDev Added unit testing project. 2023-07-24 13:01:13 -07:00
.gitignore Initial commit 2023-03-11 21:43:31 -08:00
McRule.sln TEST BROKEN - working on EF string comparisons. 2023-09-02 11:30:15 -07:00
README.md Fixed intent of negative match. The Not expression was a bitwise operation rather than logical operation. Whoops. 2023-07-24 13:01:13 -07:00
global.json Added solution file and updated filter extensions 2023-03-13 12:53:26 -07:00
license.txt Create license.txt 2023-03-11 21:47:27 -08:00

README.md

McRule

Rule based filtering using expression trees.

Predicate Grammar

Predicates are built using simple syntax to select comparison operators and methods for the specified properties on a supplied object of a specified type. That is the policy specifies the type by name, property to match against and the value the property must have. A simple equality comparison is used by default but operators can be prefixed to a policy operand for customized behavior, as shown below.

Property Type Operator Comparison Description
string * Astrisk can appear at the beginning, end or both denoting: StartsWith, EndsWith or Contains respectively.
string ~ Denotes case-insensitive comparison when used in .net, things that translate the resulting expression tree may not respect this. EF core for instance won't bind a Contains with case insensitive comparison from the string methods at all, results in a runtime error. Note: when used with wildcard, tilde operator must be first: '~*foo'.
string ! Negative expression. Must prefix all other operators.
IComparable > Greater-than comparison.
IComparable >= Greater-than or equal to comparison.
IComparable < Less-than comparison.
IComparable <= Less-than or equal to comparison.
IComparable <>, !=, ! Not-equal to comparison.

Note: the IComparable interface is mostly used for numerical types but custom types with comparison providers may work at runtime.

Examples

Notes

Publish nuget package:

dotnet nuget push McRule.0.0.5.nupkg --api-key <api key> --source https://api.nuget.org/v3/index.json