RuleEngine

The RuleEngine project is the implementation of an simple rule engine written in c# that is used to evaluate defined rules against objects. For further description please see the following post at my blog:
That simple example shows how two objects are validated against two rules:
Person person1 = new Person() { 
    Name = "Mathias", Age = 36, Children = 2, Married = true };
Person person2 = new Person() { 
    Name = "Anna", Age = 32, Children = 2, Married = false };
RuleLoader ruleLoader = new RuleLoader();
// new Rule("Age", Operator.LessThanOrEqual, 50);
Rule rule1 = ruleLoader.Load(2);
// new Rule("Children", Operator.GreaterThan, 0);
Rule rule2 = ruleLoader.Load(3);
RuleEngine.RuleEngine ruleEngine = new RuleEngine.RuleEngine();
var ruleFuncs = ruleEngine.CombineRules<Person>(
    new Rule[] { rule1, rule2 });
RuleValidator ruleValidator = new RuleValidator();
var result = ruleValidator.ValidateRulesAny(
    new[] { person1, person2 }, ruleFuncs);

Last edited Jul 15, 2015 at 7:26 AM by netmatze, version 8