寻找在.NET中简单的规则引擎库 [英] Looking for simple rules-engine library in .NET
问题描述
有谁知道一个良好的.NET库规则库(最好的开放源代码)?我需要的东西,可以做嵌套的逻辑EX pressions,如(A和B)和(B或C或D)。我需要做的对象属性,例如,A.P1和B.P1的比较。 (理想情况下,我可以比较的任何财产 - A.P1和B.P2)。
它应该存储的规则在数据库中(我已经得到了很多简单的配置逻辑)。它应该有一个规则创建/管理API。该管理工具将必须检查实例,以确定哪些属性可用以及哪个约束存在。
谢谢!
哦,还有一件事。作为一个规则引擎,我需要包括操作(命令)的概念。这些是在执行前pression回报:
如果(EX pression.Evaluation){actions.Execute(); }
所以我看到一个规则是这样的:
阶级统治
{
防爆pression精通;
操作[]操作;
运行(){如果(Exp.Evaluate()){的foreach(在操作动作){action.Execute(); }}}
}
在同意将我想说的工作流引擎家庭使用的东西虽然没有工作流程。 检查<一href="http://msdn.microsoft.com/en-us/library/system.workflow.activities.rules.aspx">System.Workflow.Activities.Rules命名空间一点点 - 这是在.net中3的支持,以及内置的.NET3.5。你什么都有了手免费使用像你提到的:
-
RuleCondition的条件,RuleAction的行动
用于描述 -
标准格式 元code(codeDOM - codeEX pressions)
-
您可以插件任何种类的复杂性 成(说除了真相 LINQ和lambda表达式等延伸 通过某种方法) TypeProviders
-
还有一个内置的编辑规则 编辑与智能感知
-
作为规则是序列化的也可以是 容易坚持
- 如果你的意思是使用过的规则 通过typeprovider数据库,然后计划 它也可以被实施
有关首发: 使用工作流之外 <规则/ P>
诗:我们正在使用它广泛,有是在该命名空间远远超过你想象 - >一个完整的元算法语言
而最重要的是:它很容易使用 - 真的
Does anyone know of a good .NET library rules library (ideally open-source)? I need something that can do nested logic expressions, e.g., (A AND B) AND (B OR C OR D). I need to do comparisons of object properties, e.g., A.P1 AND B.P1. (Ideally, I could compare any property -- A.P1 AND B.P2).
It should store the rules in a database (I've got a lot of simple configurable logic). And it should have a rule creation/management API. The management tool would have to inspect the instances to determine which properties are available and which constraints exist.
Thanks!
Oh, one more thing. As a rules-engine, I need to include the concept of Actions (Commands). These are what execute when the expression returns:
If (expression.Evaluation) { actions.Execute(); }
So I see a rule as something like:
class Rule
{
Expression Exp;
Actions[] Actions;
Run() { if(Exp.Evaluate()) { foreach(action in Actions) { action.Execute() ; } } }
}
Agreeing with will I would say use something from the workflow engine family although not workflow. Examine System.Workflow.Activities.Rules Namespace a little bit - it's supported in .Net 3, and built into .Net3.5. You have everything in hand for free to use like you mentioned :
RuleCondition for conditions , RuleAction for actions
standardized format for describing metacode (CodeDom - CodeExpressions)
you can plugin any kind of complexity into that (to tell the truth except Linq and lambdas and so extension methods of some kind) via TypeProviders
there's a builtin editor for rule editing with intellisense
as the rule is serializable it can be easily persisted
- if you meant to use the rules over a database scheme then via typeprovider it can be implemented too
For a starter : Using rules outside of a workflow
Ps.: we're using it extensively and there're much more in that namespace than you ever imagine -> a complete meta algorithm language
And the most important : it's easy to use - really
这篇关于寻找在.NET中简单的规则引擎库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!