RuleEngine in .net Core
This Project is a really simple rule engine maker that you can define your facts and develop the main functionality of rules that you are free to choose the method name. You just need to use our annotation to demonstrate actions and conditions.
You must create a new instance of rule and pass your rule class as input then call Execute
method.
You can define your facts as an input value to rules. You can add in your facts in every step of rule action method also.
Create a new instance of facts and set key-value base all facts. If you want to get a fact's value in condition but you don't define in facts it must raise an error.
- Action
- Condition
- Rule
This annotation can only set on Methods
. You can define more than one action with priority for every rule.
- Return
Void
- No Args as input
- Order : It's not requeried.Default value is
1
This annotation can only set on Methods
. You can define more than one condition. After evaluates all condition rule engine executes all actions that you develop.
- Return
Bool
- Args as demonstrate in FactArgs with the same priority
- FactArgs : Comma separated facts name
- ExceptionMessage : The message must be raised as Rule Exception when this condition result it's not true
This annotation can only set on the class. You can have more than one rule.
You must set on the class as an attribute that is your rule.
- Name : It's optional and you can set this rule name.
- Description : It's optional and you can set the main functionality of this rule.
- NextRule : It's optional and you can set the type of next rule that you have and used the rule attribute. Rule engine after running current rule actions evaluate the next one and execute if everything is going well.