You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had use NRules.Language some little time . It is powerful !
But now I have a problem when using nested objects .Think you have a "Order" object , it has a list to store the detail item. Now I have a rule that when any item has some product , the order will had a discount .
The rule look like
Name "order rule smaple"
when
var order= Order(x=>x.Items.Any(i=>i.Product.Name=="some product"));
then
order.discount=1;
Unfortunately,it is not work.The erro message say " x.Items has not a member "Any" " . When I debuging,the Items only has its' index member. So the rule only support look like "x.Items[index].Product.Name=="some product"" .
The text was updated successfully, but these errors were encountered:
jonechenug
changed the title
How to write a rule for nested objects when i using lambda?
How to write a rule for nested objects when I use lambda?
May 7, 2018
You are right, nested lambdas are not yet supported. So this is a valid feature request. It's going to take a little while to add this feature, so meanwhile you can have a workaround - encapsulate the lambda expression behind an extension method on the Order object.
snikolayev
changed the title
How to write a rule for nested objects when I use lambda?
Add support for nested lambda expressions in rule conditions
May 7, 2018
I had use NRules.Language some little time . It is powerful !
But now I have a problem when using nested objects .Think you have a "Order" object , it has a list to store the detail item. Now I have a rule that when any item has some product , the order will had a discount .
The rule look like
Unfortunately,it is not work.The erro message say " x.Items has not a member "Any" " . When I debuging,the Items only has its' index member. So the rule only support look like "x.Items[index].Product.Name=="some product"" .
The text was updated successfully, but these errors were encountered: