Looking for some Business Rules tips

Looking for some Business Rules tips

Old forum URL: forums.lhotka.net/forums/t/599.aspx


RangerGuy posted on Wednesday, July 12, 2006

Well..it's finally here... Today we start developing our new system :) I very excited to work with CSLA on a daily basis instead of rushing home after work to work more on my own project LOL!

Anyways, here's what I'm hoping some of the more experience developers can help me with.

One of the requirments for a our content management system is that the users using our design tools we are building be able to create there own validation and business rules. 

Here is a use case that someone setting up their site would want to set up in the admin section before moving the site to a production enviroment.

When a user enters code CD001 they get 15% off a specific product.

I was thinking that we could inherit the CSLA rules stuff into a custom rules object which would connect to the database and pull the rules for the site that it needs and maybe put it self  into a cache so it doesn't need to hit the db everytime a rule needs to be checked.

Any thoughts on a DB driven rules engine. We host tons of seperate websites that will be built with this custom content management system so coding business rules for each site is not feasible.

RockfordLhotka replied on Wednesday, July 12, 2006

Here are some options, I'm certain there are others:

  1. There are at least one or two XML languages out there for describing business rules. You could write code to parse that XML, translate it into code (Reflection.Emit?) and dynamically generate rule methods based on the XML rules.
  2. You could have a library of pre-defined rule types (discount, etc.), that drive off config data in the database. In other words, the behavior of getting a discount is something you code, but the specific details are supplied by the user via an admin screen.
  3. You could allow the user to write rule methods, storing the VB/C# code in the database. You could then read that code, compile it dynamically and attach the methods to your properties.
  4. You could avoid using CSLA-style rules for this purpose, and buy a commercial rules engine (Biztalk Server has one, and there are others on the market). Typically these rules engines are part of a workflow/orchestration tool, and the rules are applied as a non-interactive step in your overall workflow process.

 

RangerGuy replied on Thursday, July 13, 2006

Thanks for the tips Rocky.. I really like the 2nd option that's kind of what we were thinking :)

RockfordLhotka replied on Thursday, July 13, 2006

Yes, of all of them, I think #2 is the best approach in most cases.

Copyright (c) Marimer LLC