Questions tagged [nrules]

NRules is an open source production rules engine for .NET, based on the Rete matching algorithm. Rules are authored in C# using internal DSL.

NRules is an open source production rules engine for .NET, based on the Rete matching algorithm. Rules are authored in C# using internal DSL.

https://github.com/NRules/NRules

34 questions
10
votes
0 answers

Database Drive Rule Engine Using NRules

I am creating a business rule engine and planning to user NRules framework. https://github.com/NRules/NRules But I want to know if I can generate rule from database it self. I have a database table which has some rule saved. Age > 20 Name …
Pawan Agrawal
  • 412
  • 8
  • 26
4
votes
1 answer

NRules: Issue using DSL extension on Rule with custom base class

I am using NRules to define rules that all inherit from a common base class, which itself inherits from Rule. When I use a DSL extension to insert a new fact that wraps a matched object, it seems that the matched object passed to the extension…
Captain Whippet
  • 2,143
  • 4
  • 25
  • 34
4
votes
1 answer

Is this a proper way of defining a rule in NRules?

public class AllowAtleastOneCountryRule : Rule { public override void Define() { Profile profile = null; string str = @"At least one country has to be defined as 'permitted'"; bool enabled =…
talaa123
  • 123
  • 1
  • 2
  • 14
3
votes
1 answer

Property Injection for NRules within ABP

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…
Ivan Sager
  • 175
  • 1
  • 2
  • 12
2
votes
1 answer

How to create a validation rule with NRules?

I just discovered NRules for .NET. I would like to create a rule that prevents object construction if a field/property value is invalid. For instance, given the following class: public class Customer { public string Name { get; private set; } …
cruzan
  • 357
  • 4
  • 12
2
votes
2 answers

How to do optimal write rule definition in NRules

The code of NRules SimpleRule define the following rule: public class PreferredCustomerDiscountRule : Rule { public override void Define() { Customer customer = null; IEnumerable orders = null; When() …
Jens
  • 2,327
  • 25
  • 34
2
votes
3 answers

NRules: match a collection

I'm trying to figure out the BRE NRules and got some examples working but having a hard time to match a collection. IEnumerable orders = null; When() .Match>(o => o.Where(c => c.Cancelled).Count() >= 3) …
Elger Mensonides
  • 6,930
  • 6
  • 46
  • 69
1
vote
0 answers

NRules—How to Build List of Array Indexes of Matches

I have two lists of objects. I want to loop though the first list and see if there are any matches in the second list, based on multiple fields, and I'd like to use a method which returns a bool to do the logic. However, I don't know if that will be…
birdus
  • 7,062
  • 17
  • 59
  • 89
1
vote
1 answer

NRules Adding Additional Condition

I have a rule such as When() .Match(a => a.Field1 == "xxx", a => a.Field2 == "yyy", a => a.List1.Where(l => l.Field3 = "111").Count() > 0); Which returns results However when I try to add additional…
CB1
  • 31
  • 3
1
vote
1 answer

NRules: building a rule for complex types

Given the following domain model public class Person { public string Name { get; set; } public int Age { get; set; } public List Cars { get; set; } } public class Car { public int Year { get; set; } public string Make { get; set;…
jalley
  • 105
  • 1
  • 5
1
vote
1 answer

How to create dynamic NRules

I am getting this exception: variable 'e' of type 'MyClass' referenced from scope '', but it is not defined I want to create dynamic rules with nested property. When I create static rules it works fine, but not in dynamic mode. Also, I want to use…
1
vote
1 answer

Best way to achieve forward chaining in NRULES

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…
Kishore
  • 29
  • 3
1
vote
0 answers

UI for creating business rules in NRules

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…
Khaled
  • 841
  • 3
  • 13
  • 22
1
vote
1 answer

How can I load all dlls from a folder without knowing their names in c# .net?

Previously I was using this call to load all cs file that extends from Rule class var repository = new RuleRepository(); repository.Load(x => x.From(typeof(Rule1).Assembly)); By calling Load method as shown above all the class files of the same…
talaa123
  • 123
  • 1
  • 2
  • 14
1
vote
1 answer

How can I develop a rule editor for my users with NRule at the back end?

I've gone through how to guide of NRule. However, I am not clear on how can I provide a user interface where one can define their rules and later execute them on some model. For example: I have a web application where authorized users drafts a…
talaa123
  • 123
  • 1
  • 2
  • 14
1
2 3