In a web application i'm working on, items can pass through multiple states (eg. workflow) and after each workflow a rule can be run after each step which can stop the process or display additional messages.
How should these rules be defined? I was thinking about a dll per rule (and hooking them up either with MEF or events) but one application could have 200-300 customers in it each with a few rules which becomes a lot of dlls.
Update:
These rules could be like the following. Say you submit an invoice but you only want to authorize it from your approver if its over a certain amount, then a rule like this would be invoked to return true or false and then proceed accordingly.
Cheers.
Sounds like an application that might benefit from using business rules written in a dynamic language like Ruby or Python. IronPython integrates nicely with applications written in C# or VB.NET. You could create a DLR ScriptEngine and ScriptScope in your web application, inject rules written in the dynamic language based on a client ID parameter to interact with your live Plain Old .NET Objects (PONO). You could keep your hundreds of rules in a database because they are just text (Python source code for example). Check out this blog post I wrote which shows how to inject dynamic business rules into a .NET application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With