jiffyjub wrote:
would you have any suggestion for code gen's.
CSLA proclaims that hidding the data access code in the business object is a good thing. so in there words yes the actual data access code is hidden but "in the object " I dont know !
CSLA'a data access layer just call's the save, update , delete methods that are in the BO.
any how thx for your reply
Mygeneration is a good code generation tool that uses templates to generate business objects/mapping files for multiple O/RM tools (nhibernate, and CSLA are supported along with several others).
I'm currently in the process of developing a template based code generator based on the Domain Specific Language tools, but it's not even in the alpha stage yet.
There is nothing wrong with putting the CRUD methods on your business objects in and of itself. It's just another way of tackling the data tasks.
Again I'm not familiar with CSLA so I can't tell you if there are any pitfalls involved. Generally, you want to avoid non static (or shared) select methods on the business object. In other words, having to create a business object in order to retrieve a business object from the database is just a bad idea. I actually ran into that pitfall the first time I tried programming the DAO pattern...I thought the DAO and the DTO should be the same.
Believe me, it's not a pretty thing to have to deal with. If CSLA requires something like this, I'd argue that you try to shield the rest of your code from it.