nrules

Property Injection for NRules within ABP

允我心安 提交于 2021-01-07 02:37:54
问题 I am using ABP Boilerplate 6.0 and have integrated NRules with our platform. I am able to get the rule below to work, but the issue is that I cannot use the injected ‘_questionResponseRepository’ within the rule condition, because only after the rule criteria are met, does the resolution of dependencies take place. I would like to use ‘_questionResponseRepository’ to get from the database a list of keywords and use those words in the Rule match condition The Calling code public

Accessing elements of types with runtime indexers using expression trees

 ̄綄美尐妖づ 提交于 2019-12-24 21:34:30
问题 I want to validate rule against input array data with runtime indexer not with some fixed zero index value. It works if i insert data one by one in session.Insert() It does't work if i use sesion.InsertAll() with array data I tried providing Expression.Constant value to indexer but no action triggers class Program { static void Main(string[] args) { RuleTestWithSingleInsertData(); // RuleTestWithInsertDataAll(); Console.ReadKey(); } public static void RuleTestWithSingleInsertData() { try {

UI for creating business rules in NRules

♀尐吖头ヾ 提交于 2019-12-13 03:47:24
问题 I have been searching for a rules engine to be used in a data import system i am creating. I found several rules engines but it looks like NRules is the most popular also i found CodeEffects which is good but not free. So i was wondering if there is a friendly UI to let the end-users create the rules with NRules just like CodeEffects demo. Appreciate your help. 来源: https://stackoverflow.com/questions/46756032/ui-for-creating-business-rules-in-nrules

Best way to achieve forward chaining in NRULES

时间秒杀一切 提交于 2019-12-11 08:54:15
问题 I want to run a rule based on the result of a previous rule. How can I achieve this functionality using forward chaining? I don't want to create a different class object for each rule to achieve forward chaining. Here in this example an InstantDiscount object is created just for this one rule to achieve forward chaining. public class PreferredCustomerDiscountRule : Rule { public override void Define() { Customer customer = null; IEnumerable<Order> orders = null; Double total = Double.NaN;

NRules: match a collection

核能气质少年 提交于 2019-12-07 22:07:22
问题 I'm trying to figure out the BRE NRules and got some examples working but having a hard time to match a collection. IEnumerable<Order> orders = null; When() .Match<IEnumerable<Order>>(o => o.Where(c => c.Cancelled).Count() >= 3) .Collect<Order>(() => orders, o => o.Cancelled); Then() .Do(ctx => orders.ToList().ForEach(o => o.DoSomething())); Basically what I want is if there are 3 orders cancelled then do some action. But I can't seem get a match on a collection, single variables do work. The

NRules: match a collection

坚强是说给别人听的谎言 提交于 2019-12-06 05:49:02
I'm trying to figure out the BRE NRules and got some examples working but having a hard time to match a collection. IEnumerable<Order> orders = null; When() .Match<IEnumerable<Order>>(o => o.Where(c => c.Cancelled).Count() >= 3) .Collect<Order>(() => orders, o => o.Cancelled); Then() .Do(ctx => orders.ToList().ForEach(o => o.DoSomething())); Basically what I want is if there are 3 orders cancelled then do some action. But I can't seem get a match on a collection, single variables do work. The program: var order3 = new Order(123458, customer, 2, 20.0); var order4 = new Order(123459, customer, 1