This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
picture the following scenario: method A gets an int Id, using a unit of work (UOW) it checks if a system with this Id exists if unit exists call method B to update the unit, method C needs a UOW if unit DOES NOT exist call method C that uses a UOW, creates a new unit and sets it's data there are few ways to handle the UOW creation: A: create a UOW in A, and then another one in B or C B: create a UOW in A, exit the 'using clause' and then call B or C that create their own UOWs C: pass A's UOW as argument to either B or C recommendations? correct way to do it? i'll be happy to hear any opinion thanks doron weiss |
|
|
Where do you intend to persist the changes? If you are encapsulating this inside B and C then either options A or B will be the right approach. If A is going to act as the controller for the transaction then option C will be the approach you want. Generally speaking option C would be the best approach as it keeps the actual UnitOfWork interaction scoped within a single method and B/C as simply responsible for object manipulation.
|
|