runxc1 / MicroRuleEngine

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

Is there currently support for runtime target values for serialized rules? #20

Closed michaelmarcuccio closed 4 years ago

michaelmarcuccio commented 4 years ago

If I needed to have the target of a rule be DateTime.UtcNow.AddDays(-30), and this rule is serialized into JSON, the result will be the datetime when serialized. How would you use a target that should get its value at run-time? I am just wondering if this is currently supported or I would need to add this on.

i.e. Rule.Create("Date", mreOperator.LessThanOrEqual, DateTime.UtcNow.AddDays(-90))

jamescurran commented 4 years ago

Support for a general expression evaluator might be too big a feature for this.

However, adding a few keywords for specific values might be more practical, say "NOW-90D" (I suspect that 90+% use of this feature would be for day range from today)