动态业务规则
我正在创建一个界面,用户可以在运行时从特定于域的对象构建自己的业务规则,将这些规则保留在数据库中,然后由应用程序使用。其中一些是复杂的谓词,而另一些则需要领域对象以看似相当复杂的关系进行组合。到目前为止,我已经研究了 GoF、eval 的动态以及 CodeDom。有人对应该使用什么有建议吗?
I am creating an interface where users can build their own business rules out of domain specific objects at runtime, have those rules persisted in the database and then used by the application. Some of these are complex predicates and others require combinations of domain objects in what seems fairly complicated relations. So far I have looked into GoF, dynamics with eval, and CodeDom. Does anyone have suggestion on what should be used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
实际上,您可以仅使用 WF 规则引擎 API 来开发应用程序,而无需使用 WF。 http:// /blogs.microsoft.co.il/blogs/bursteg/archive/2007/08/09/WF-Rules-Engine-without-Workflow.aspx 这将为您省去很多麻烦 工作。
Actually, you can just develop your application with WF rules engine API without using WF. http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/08/09/WF-Rules-Engine-without-Workflow.aspx This will save you from a lot of work.
Kaizen,根据动态规则的范围和类型,您最终可以使用工作流引擎(例如 MS WF)将规则定义为工作流活动……通过这种方式,您可以隔离逻辑,并且不需要完全重建当您需要更改工作流程中的任何内容时,请使用该应用程序。
这可能不是最好的解决方案,但可能是替代方案......
Kaizen, depending on the scope and kind of your dynamic rules you could eventually use a workflow engine, like MS WF to define the rules as workflow activities for example... in this way you isolate the logic and do not need a full rebuild of the application when you need to change anything in the workflow.
This might not be the best solution but could be an alternative...
我花了一年的时间构建规则引擎并研究方法,我可以告诉你这并不容易。尤其是当你专注于你的目标时。如果是为了让用户为系统编写规则,那么你确实需要重点关注该领域。对于开发人员来说容易的事情对于大多数业务用户来说可能要困难得多。我们在 Excel 中构建了一个规则编写平台,该平台被编译为 C# 并动态运行...问题是用户发现电子表格和逻辑流程过于复杂,并聘请了 ASp.NET 承包商来构建规则。
BizTalk 有一个我相信可以用于 .NEt 应用程序的引擎
http://www.microsoft.com/biztalk/en/us /business-rule-framework.aspx
玩得开心!
Having spent a year building a rules engine and fighting on approaches I can tell you its not easy. Especially when you focus on what your goal is. If its to get users to write the rules for the system, you really need to focus hard on that area. Whats easy for a developer is perhaps much harder for most business users. We built a rules authoring platform in Excel that was compiled into C# and run dynamically ... problem was users found the spreadsheets and flow of logic too complicated and hired ASp.NET contractors to do build the rules.
BizTalk has an engine that I believe can be used for .NEt apps
http://www.microsoft.com/biztalk/en/us/business-rule-framework.aspx
Have fun!
规则多久更改一次?构建一个让企业构建(和版本化)自己的规则的系统比构建一个让程序员动态更新规则的系统更具挑战性。
当过去的项目中出现类似的要求时,该企业承认,虽然是的,但规则会改变;他们不会经常改变,所以必须由他们来进行更新。
我们最终使用 IronPython 来处理动态部分,并将代码存储在数据库中,系统将在加载时提取适当的规则。应用程序的其余部分是用 C# 编写的。对我们和企业来说都是双赢。
How often do the rules change? Building a system that let's the business build (and version) their own rules is significantly more challenging than building a system that lets a programmer update the rules dynamically.
When a similar requirement came up in a past project, the business admitted that while yes, the rules will change; they won't change so often that it has to be them making the updates.
We ended up using IronPython for the dynamic parts and storing the code in the database and the system would pull up the appropriate rules on load. The rest of the app was written in C#. A win for us and for the business.