Open solutions-simplified opened 11 months ago
can you provide me details on how you pass inputs to RulesEngine?
Also can you try if AutoRegisterInputType = false
in ReSettings helps mitigate the issue?
@abbasc52 here is what I currently have.
var ruleParameters = new RuleParameter[] { new RuleParameter("emails", emailsDataset), new RuleParameter("customer", newCustomer) };
var rulesEngine = new RulesEngine( new Workflow[] { workflow }, new ReSettings { CustomTypes = new Type[] { typeof(Utils) }});
var ruleResults = await rulesEngine.ExecuteAllRulesAsync(workflow.Name, ruleParameters);
@abbasc52 I wanted to follow up on this - any suggestions :)
@solutions-simplified I assume your customer
input is of Type Customer
. There is a bug in our dependent lib where if the names are same for input and type(even if case are different), uses the type instead of input.
I am working with the lib to fix this issue, but meanwhile u can use try the below fixes:
new ReSettings { CustomTypes = new Type[] { typeof(Utils) }}, AutoRegisterInputType : false );
I recently upgrade from 4.0.0 to 5.0.1. I am getting errors across the board and it looks like it's related to the breaking change in 5.0.0. In my Utils class I have static methods that take in strongly typed objects (see below). I keep getting a Common Language Runtime error when these rules execute. It appears to be because it can't actually execute my method in the Utils class. Suggestions?
I reviewed the Wiki but the examples shown with Utils is simple string parameters, but do not see any examples with extension methods utilizing strongly typed objects. If I lower back to 4.0.0 everything works as expected.
My expression: customers.Where(CreatedDate >= createdFilterParameter).Where(Utils.IsExistingEmail(Emails, newCustomerDataParameter)).Count() < threshold
Thank you in advance for any suggestions - this library is awesome :)