Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rules engine design & examples in c#

I am currently writing a .net application with c# and want to check a number of rules and based on passing or failing the rules, perform an action. So I am looking to implement a generic solution that I can reuse adhering to good oop principles. This has lead me to the conclusion that I need to write a rules engine.

I have good knowledge of c# but this is the first time I have needed to write a rules engine so as part of my research in to the design and development of such, I am looking for any tips regarding the creation of such an engine. What would be great further would be any examples out there that I could look at? Any c#/.net rules engine applications? What layer in a typical 3 tier architecture should such reside at? I had a quick look on the codeplex and google code but none jumped out at me! So some direction would be great.

like image 996
amateur Avatar asked May 14 '11 00:05

amateur


1 Answers

Actually .NET has a top-notch rules engine meant to be used with workflows (as it is designed to be) but can be used outside of workflows easily: You should see "Windows Workflow Foundation Rules Engine" and inspect the System.Workflow.Activities.Rules namespace.

Learning how to use rules outside of workflows takes only a bit of googling.

Edit: If you want to inspect the architecture, here is two open-source prebuilt engines:

  • NxBRE
  • .NET Application Block for Validation and Business Rules
like image 132
Teoman Soygul Avatar answered Oct 03 '22 07:10

Teoman Soygul