Nice work...

Oct 23, 2007 at 11:51 AM
Just like to say 'hi' and keep up the good work, I've been looking for .Net (C#) examples of DDD to help me get a better understanding and this has filled some of my knowledge gaps. I do have a couple of questions:

1. Have you considered adding a 'Rollback' to your unit of work pattern and if so why was it not implemented?

2. You mentioned the use of POCO entities and the fact that this leads to the 'anaemic domain model' discussion ( I Personally don't have a problem with POCO's) but have you considered adding some validation to the POCO entities ? As far as I can see you are relying on the database and referential integrity to validate an constraints on the data.
Oct 24, 2007 at 4:38 AM
Edited Oct 24, 2007 at 4:54 AM
Hi, thanks for the compliment! Here are my answers to your questions:

1. Have you considered adding a 'Rollback' to your unit of work pattern and if so why was it not implemented? ==> It is already implemented...In the Commit method of the UnitOfWork class, since I am using the TransactionScope class, nothing gets committed until I call the Complete method of the TransactionScope. In the TransactionScope class, if the Commit method is not called during the scope of the transaction, then the transaction is automatically rolled back.

2. You mentioned the use of POCO entities and the fact that this leads to the 'anaemic domain model' discussion ( I Personally don't have a problem with POCO's) but have you considered adding some validation to the POCO entities ? As far as I can see you are relying on the database and referential integrity to validate an constraints on the data. ==> I have been fairly light on validation in the Entity classes...In some cases where the validation is part of the domain model, I am using the Specification pattern to deal with any type of constraints or business rule enforcement. That's the second comment I've gotten about validation, so that is definitely something I will need to back and do some refactoring in some of the Entity classes in the Model.
Oct 24, 2007 at 10:28 AM
Hi,

I suppose what i mean by no 'Rollback' is that you haven't explicitly defined a method that will allow you to unregister an entity from the UnitOfWork class - I guess you wouldn't ever have mutliple UnitOfWork instances inside a service entitiy as this would be violation of the principles of the pattern, so therefore placing the actual calls to persist data inside the 'Complete' method makes sense.