Views: 23.2K
Replies: 6
Archived
|
UnitOfWork in Patterns in Action version 4.0I'm not seeing UnitOfWork pattern in PatternsInAction project (version 4.0).
Have I missed something or this is not part of version 4? Thanks Garry Gill, Jul 20, 2010
|
|
Reply 1I would like to see this too. Has there been any update in this regard?
Scott Shepherd, Oct 31, 2012
|
|
Reply 2I'd like to see this built into your framework in an upcoming release. I think this would be helpful as there is so much buzz regarding using this approach.
Thanks, Chris Chris Langston, Sep 06, 2011
In order to have MEF create the part you have to do a few things.
1. The part itself has to have an Export on it. Which you would achieve by adding an [Export] attribute to the class.
2. If the part is in Silverlight it must be public, otherwise private is fine.
3. You pull on the container to create the part.
a. You can pull on it directly by calling container.GetExportedValue();
b. You can ask the container for a part which imports Test. (using GetExportedValue)
c. You call SatisfyImportsOnce/ComposeParts (or CompositionInitializer.SatisfyImports on Silverlight) on an instance that imports Test.
Cheers
Dec 29, 2010
|
|
Reply 3I too like to see an explicit UnitOfWork Pattern.
Madeshwaran Mohanraj, Jan 18, 2011
|
|
Reply 4I too would like to see an implementation of the UnitOfWork pattern.
Andrew Walker, Jan 14, 2011
|
|
Reply 5I would personally prefer explicit UnitOfWork because there are lot many chances that we update multiple tables in one call. So, we would need commit and rollback (in case of error).
Garry Gill, Jul 20, 2010
|
|
Reply 6The DataContext class in LINQ to SQL and the ObjectContext class in the Entity Framework are both examples of a Unit of Work.
But in our Design Pattern Framework we have not explicitly described is as the Unit of Work Pattern. The transaction model has been kept simple and all transactions are handled implicitly (Auto Commit). The Unit Of Work pattern is particularly relevant with systems where you update multiple tables (or rows) in a single Unit of Work, that is, they all fail or all succeed. This is a common situation, but, again, it is not mentioned or referenced in Patterns in Action. However, if there is interest we can add it to our next upgrade. Any thoughts? Dan McMillan, Jul 20, 2010
|