Adding Business rules to your DAOs with Repository.

So if you have a series of POCOs,  and like a good developer you’re using some nice ORM like NHibernate or Entity framework, and you have a Repository pattern going on, but now you want to add in business rules which are more complex than the vanilla validation routines. Where do you put them if you don’t want to just stick them straight onto the object?

RulesEngine is an excellent little project which allows you to define validation rules  for objects, and extend them as you wish. Integrating this with a repository pattern, using MEF as the glue between your models, your classmaps and the business rules, enables good separation of concerns while enabling full BL functionality.

Might write a bit more on this if I get time, but really it’s just a note on a pretty prepackaged repo pattern I have stashed here.


About this entry