简体   繁体   English

规则引擎与富域模型

[英]Rules engine vs rich domain model

I'm looking into NRules.Net to implement my pricing engine. 我正在研究NRules.Net来实现我的定价引擎。 After some testings, I don't really understand the benefits of using a .net rules engine vs using a rich domain model... 经过一些测试,我真的不了解使用.net规则引擎与使用丰富域模型的好处...

  • Rules are still plain CS classes (there is nothing dynamic) 规则仍然是普通的CS类(没有动态的)
  • I have to deal with a black-box (the rule engine) which does not allow me to understand what is going on 我必须处理一个黑匣子(规则引擎),它不允许我了解发生了什么

In the end, why shall I go for a .net rule engine? 最后,为什么我要使用.net规则引擎? Is there anything I'm missing? 有什么我想念的吗?

Thanks Seb 谢谢塞伯

A rules engine allows you to reason about a Rule as a concept of its own and gives you an elaborate language to play with rules. 规则引擎使您可以将规则作为其自身的概念进行推理,并为您提供一种精通规则的语言。

You can compose rules dynamically, classify and manipulate lists of rules with different priorities, manage conflicting rules, express them with a convenient DSL that business people might understand, create transformations to make an object comply with a rule, etc. 您可以动态地编写规则,对具有不同优先级的规则列表进行分类和处理,管理冲突的规则,使用商务人士可能理解的便捷DSL来表达它们,创建使对象符合规则的转换等。

Without an abstraction of what a Rule is, you can't do all this in a conscious, consistent way. 没有对规则的抽象,您将无法以自觉,一致的方式完成所有这些工作。

Not all domains need it but if that general concept often comes up in discussions with your domain experts, a rules engine is probably worth having a look at. 并非所有领域都需要它,但是如果通常在与您的领域专家进行讨论时提出这个一般概念,那么规则引擎可能值得一看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM