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
1
vote
1 answer

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. private static ISession session; //this is…
Jose
  • 1,130
  • 3
  • 15
  • 25
0
votes
0 answers

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 = default; Seating seating = default; …
Sakary
  • 5
  • 1
0
votes
0 answers

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("AutoRepoRule")] public class…
user14463446
  • 99
  • 10
0
votes
1 answer

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 When() .Match(() => customer) …
jnce
  • 3
  • 1
  • 3
0
votes
1 answer

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…
0
votes
1 answer

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 longOrderKey = (managedAccount.AccountId,…
Quark Soup
  • 4,272
  • 3
  • 42
  • 74
0
votes
1 answer

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.Compile() takes almost 6 seconds. Is anybody had…
0
votes
1 answer

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 values, and inputB = a single value. When all true,…
TasMot
  • 21
  • 2
0
votes
1 answer

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 days but didn't find anything. Any help is…
Amrinder Singh
  • 69
  • 1
  • 10
0
votes
1 answer

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() { A t = null; When().Match(() => t); …
0
votes
1 answer

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.InsertAll() with array data I tried providing…
0
votes
1 answer

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; foreach (var rule in rules) { …
0
votes
1 answer

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 Interface definition { public interface…
Alex
  • 3,941
  • 1
  • 17
  • 24
0
votes
1 answer

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 fact) methods. Now, one of the facts changes and I call the this.session.Replace(object fact). How does NRules know which…
Quark Soup
  • 4,272
  • 3
  • 42
  • 74
0
votes
1 answer

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 = Assembly.LoadFrom($"{rule.AssemblyName}.dll"); …
IntoNET
  • 456
  • 2
  • 14