基于c#的规则语言的例子?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43805/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 09:54:06  来源:igfitidea点击:

Example of c# based rule language?

提问by aku

Can you provide a good example of rule definition language written in C#.
Java guys have JESS, is there anything good for C#?

你能提供一个用 C# 编写的规则定义语言的好例子吗?
Java 家伙有JESS,对 C# 有什么好处吗?

采纳答案by Jon Limjap

This page shows some examples of open-source rules engines in C#: http://csharp-source.net/open-source/rule-engines

此页面显示了 C# 中开源规则引擎的一些示例:http: //csharp-source.net/open-source/rule-engines

回答by samjudson

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.

有 Microsoft 业务规则引擎:http: //msdn.microsoft.com/en-us/library/aa561216.aspx。不确定它是否只能在 Biztalk 中使用 - 它确实说它是一个 .Net 类库。

回答by samjudson

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.

Microsoft 业务规则引擎 (BRE) 非常好。但是(这是一个很大的 BUT)您需要一个 BizTalk Server 许可证才能使用它。

回答by Sentient

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.

您可以使用作为 Windows Workflow Foundation(.NET 3.5 及更高版本)一部分的前向链推理引擎。最好的部分是它具有免费的运行时许可。

You can use the Rule Managerfrom 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)

您可以使用Acumen Business的规则管理器并安装 Windows Workflow Foundation 适配器。安装后,将规则导出为 WFRules (*.rules)。将生成一个 Visual Studio .NET 解决方案,显示如何独立调用规则引擎(不需要工作流)

See also http://bizknowledge.blogspot.com/search/label/Windows%20Workflow%20Foundation

另见http://bizknowledge.blogspot.com/search/label/Windows%20Workflow%20Foundation

回答by RobS

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.

您可以将Windows Workflow Foundation(WF) 的工作流引擎与 C# 结合使用。我开始了一个使用 WF 作为工作流引擎的小而简单的项目,它实际上使用起来非常简单。在这里查看我一直在开发的第一部分条目。

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).

WF 的有趣之处在于,如果您愿意,您不必使用整个事物 - 如果您只想针对某些实体或对象编写一些自定义规则,您可以 - 非常巧妙!此外,它比 BizTalk 的 BRE(并且没有许可成本)要少得多。

You need to add a reference to the following .Net assemblies, available in the .Net Framework v3.0 and onwards:

您需要添加对以下 .Net 程序集的引用,可在 .Net Framework v3.0 及更高版本中使用:

  • System.Workflow.Activities
  • System.Workflow.ComponentModel
  • System.Workflow.Runtime
  • 系统.工作流.活动
  • 系统.工作流.组件模型
  • 系统.工作流.运行时

Check out the article for more info.

查看文章了解更多信息。

回答by Arnaud

Try http://rulesengine.codeplex.comIt has a fluent-interface wrapper for creating rules. It's lightweight and simple to use.

试试http://rulesengine.codeplex.com它有一个用于创建规则的 fluent-interface 包装器。它轻巧且易于使用。

回答by John Hansen

Take a look at Jetfire on codeplex. It supports forward chaining 'rules'.

在 codeplex 上查看Jetfire。它支持前向链接“规则”。