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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
147 views

NRule: understanding sample

I haven't done much of C# for last few years and recently I was trying to use NRules for rule engine implementation. While going through the sample Context context = default; LastSeat lastSeat ...
Sakary's user avatar
  • 5
0 votes
0 answers
69 views

How to store temporary variable inside Any in NRules

I have a query where I am calculating flag and based on the flag value, I am filtering users. Is there a way to store flag value inside query so that I dont need to call flag function twice? [Name(&...
user14463446's user avatar
0 votes
1 answer
112 views

How to use Rule# to author NRules that consume multiple class objects

I wish to use Rule# to author rules in my application using the NRules engine. Since I would like users to author their rules at runtime, I wish to know if it is possible to do something like this ...
jnce's user avatar
  • 15
1 vote
0 answers
43 views

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 ...
birdus's user avatar
  • 7,194
0 votes
1 answer
228 views

Applying NRules on excel dataset

I have an excel with the number of records. I want to apply Nrule on it. I want to match two rows and apply rules on them and check whether it is breaking it or not. for example : Id Date Desc 1 12/...
Vatsal Agravat's user avatar
0 votes
1 answer
74 views

Why does IContext.RetractLinked require two parameters?

I added a linked fact using: context.InsertLinked(longOrderKey, longOrder); At some point later, I want to remove this fact. It's easy for me to construct the key without having the record: var ...
Quark Soup's user avatar
  • 4,410
0 votes
1 answer
213 views

NRules rulesRepo.Compile() slow

I've started to work with NRules a couple weeks ago. I like it a lot. But the issue I am getting is performance... I have about 1500 rules (may be it's to many?) built dynamically, and my rulesRepo....
Sergey V. Kovalenko's user avatar
-2 votes
1 answer
367 views

NRules with Asp.Net Core scoped dependency could not be resolved

I am getting the following error when I run the sample here. Cannot resolve scoped service 'IPersonService' from root provider. I want to inject the service IPersonService into the rule ...
VivekDev's user avatar
  • 21.8k
0 votes
1 answer
482 views

NRules - Organizing Rules

When organizing rules for NRules, is it necessary to only have 1 When/Then group in a file? I have one rule that looks at 3 conditions (fact matches), is flagA = false, inputA = one of a list of ...
TasMot's user avatar
  • 31
0 votes
1 answer
3k views

Does anyone have a working example of dynamic NRules?

I'm looking for a working example of dynamic NRules. Actually, I want to write the rules in a notepad file and want to read them at runtime. I have been searching it through the internet for last 4 ...
Amrinder Singh's user avatar
3 votes
1 answer
595 views

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’ ...
Ivan Sager's user avatar
1 vote
1 answer
229 views

NRules Adding Additional Condition

I have a rule such as When() .Match<ObjectA>(a => a.Field1 == "xxx", a => a.Field2 == "yyy", a => a.List1.Where(l => l....
CB1's user avatar
  • 31
0 votes
1 answer
230 views

NRules Issue: Rule Matching on super class dont work

i have a class C, which inherits from A. Now i want to write a Rules, that matches on type A. So I tried the following code: public class tmp : Rule { public override void Define() { ...
user3452883's user avatar
-1 votes
1 answer
589 views

I need to create a system with dynamic rules created/edited bythe user on the UI using aspnet core

I need to create a system with dynamic rules created/edited bythe user on the UI using aspnet core. I researched some frameworks and the best i found was the NRULES, but i belive that is not gonna ...
Victor Souza's user avatar
1 vote
1 answer
935 views

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<Car> Cars { get; set; } } public class Car { public ...
jalley's user avatar
  • 105
0 votes
1 answer
286 views

Accessing elements of types with runtime indexers using expression trees

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....
Ghanshyam Singh's user avatar
0 votes
1 answer
531 views

Is there a way to run NRule Engine in asyncronously?

I want to run all rules asyncronously to make it thread safe When i m performing load test then why RuleEngine taking so much time to execute all rules. NRuleRepository repository = null; ...
Ghanshyam Singh's user avatar
0 votes
1 answer
1k views

How to inject DbContext into NRules class constructor?

I am using NRules to define rules and trying to using interface inside NRules base class but something goes wrong and I get "No parameterless constructor defined for this object" error. Here is my ...
Alex's user avatar
  • 3,961
0 votes
1 answer
395 views

How does an NRules Session compare facts?

I put facts into the Working Set using the this.session.Insert(object fact1) or this.session.InsertAll(IEnumerable<object> fact) methods. Now, one of the facts changes and I call the this....
Quark Soup's user avatar
  • 4,410
1 vote
1 answer
2k views

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 ...
Ghanshyam Singh's user avatar
4 votes
1 answer
1k views

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 ...
Captain Whippet's user avatar
0 votes
1 answer
132 views

Registering dynamically loaded DLLs with Castle Windsor

I have this piece of code in the constructor of a class. rules = rulesEngineRepository.GetRules(x => x.Enabled); foreach (var rule in rules) { var ruleAssembly ...
IntoNET's user avatar
  • 456
0 votes
1 answer
1k views

NRules: how to organize rules in modules and enable/disable with other rules

I am getting started with NRules. Here's an outline of some key requirements for the application I am building: Some of the rules determine if groups of other rules should be applied. For example (in ...
Captain Whippet's user avatar
1 vote
1 answer
2k views

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 ...
Kishore's user avatar
  • 29
1 vote
0 answers
3k views

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 ...
Khaled's user avatar
  • 841
0 votes
1 answer
2k views

Where is NRules documentation gone?

Can someone kindly point out where NRules documentation is? The links that I found shown below are all broken. Getting-Started. Index I hope this is not a depreciating project :( If that is the ...
VivekDev's user avatar
  • 21.8k
4 votes
1 answer
3k views

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'"; ...
talaa123's user avatar
  • 123
1 vote
1 answer
2k views

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 ...
talaa123's user avatar
  • 123
10 votes
0 answers
2k views

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 ...
Pawan Agrawal's user avatar
1 vote
1 answer
2k views

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 ...
talaa123's user avatar
  • 123
2 votes
1 answer
3k views

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 ...
cruzan's user avatar
  • 357
1 vote
1 answer
887 views

How to update Fact when using static ISession Rules at runtime NRules

Using NRules, I want to be able to create a session, insert facts, have it fire and complete, and while the session is still alive in memory (static variable) I want to call an update on the fact. ...
Jose's user avatar
  • 1,130
2 votes
2 answers
2k views

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; ...
Jens's user avatar
  • 2,407
2 votes
3 answers
4k views

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<Order> orders = null; When() .Match<IEnumerable<Order&...
Elger Mensonides's user avatar