runxc1 / MicroRuleEngine

A .Net Rule Engine for dynamically evaluating business rules compiled on the fly.
MIT License
186 stars 74 forks source link

Compatibility w/ IConfiguration #29

Open mguinness opened 3 years ago

mguinness commented 3 years ago

I had to tweak the rule class to change Inputs field from IEnumerable to IList for compatibility w/ IConfiguration. I updated tests and also added section to README for details in use.

jamescurran commented 3 years ago

I can't see how I'd implement the Inputs property without used a List<> or an array as the backing store, so this shouldn't be a problem.

mguinness commented 3 years ago

If I need the opposite of IsInInput is there a way to do that other than creating a new expression like below?

case "NotInInput":
    return Expression.Not(Expression.Call(Expression.Constant(rule.Inputs.ToList()),
                            _miListContains.Value,
                            propExpression));

Or maybe add a new boolean field called Negate on Rule class that would invoke Expression.Not if true?

mguinness commented 3 years ago

@jamescurran Do you think that this can be merged, do you need anything else from me?

mguinness commented 3 years ago

@jamescurran Any update on if this change to support the JSON configuration provider can be merged?