问题
Can you provide a good example of rule definition language written in C#.
Java guys have JESS, is there anything good for C#?
回答1:
This page shows some examples of open-source rules engines in C#: http://csharp-source.net/open-source/rule-engines
回答2:
You can use the forward chaining inference engine that is part of Windows Workflow Foundation (.NET 3.5 and higher) The best part is that this has a free runtime licensing.
You can use the Rule Manager from Acumen Business and install the Windows Workflow Foundation adapter. Once installed, export the rules as WFRules (*.rules). A visual studio .NET solution will be generated that shows how the rule engine can be invoked standalone (no workflow is necessary)
See also http://bizknowledge.blogspot.com/search/label/Windows%20Workflow%20Foundation
回答3:
Try http://rulesengine.codeplex.com It has a fluent-interface wrapper for creating rules. It's lightweight and simple to use.
回答4:
You could use Windows Workflow Foundation's (WF) workflow engine with C#. I'd started a small and simple project using WF as the workflow engine, it's actually quite straightforward to use. Check out the first part entry I've been developing on this here.
What is interesting about WF is that you don't have to use the whole thing if you want to - if you only want to write some custom rules against some entities or objects, you can - quite ingenious! Also, it's a lot less to take on board than BizTalk's BRE (and no licensing cost).
You need to add a reference to the following .Net assemblies, available in the .Net Framework v3.0 and onwards:
- System.Workflow.Activities
- System.Workflow.ComponentModel
- System.Workflow.Runtime
Check out the article for more info.
回答5:
There is the Microsoft Business Rules Engine: http://msdn.microsoft.com/en-us/library/aa561216.aspx. Not sure if it can only be used inside Biztalk - it does says it is a .Net Class Library.
回答6:
Microsoft Business Rule Engine(BRE) is quite nice. But(and that's a big BUT) you'll need a BizTalk Server license to use it.
回答7:
Take a look at Jetfire on codeplex. It supports forward chaining 'rules'.
来源:https://stackoverflow.com/questions/43805/example-of-c-sharp-based-rule-language