How to handle complex and changing business rules
I have to come up with an idea on how to transparently create invoices. Customers are diverse and usually government type institutions. As such, they have strict rules for creating invoices and what goes into them. The rules are very specific and different between customers. For example:
- For every 10 items, another invoice needs to be created
- If a specific service is going into invoice, materials used should be excluded
- Some items are free of charge either by contract or by law
- Some really expensive items must go into separate invoi开发者_运维知识库ces
Rules are IMO too diverse to be saved in relational database in a traditional form and they are too flexible to be hard coded into the system. So, the question is: how would you solve this challenge?
Windows Workflow Foundation is designed to address these types of problems. It contains an expression engine for evaluating which steps should be taken based on a series of conditions such as customer properties etc.
Here's an introduction to the framework: Link
And another introduction to its rules / expression engine: Link
You should use a Business Rules Engine (BRE).
There are several options :
- Drools.net http://droolsdotnet.codehaus.org/ (inactive)
- NxBRE http://sourceforge.net/projects/nxbre/#item3rd-5 (last update : last month)
- acumen http://acumenbusiness.com (but seems not free)
- and .Net Engine WWF
精彩评论