Views: 13.3K
Replies: 1
Archived
|
Unit-of-Work Design Pattern vs TransactionsHello devs:
I started reading up on Unit-of-Work (UoW) patterns for example here: Martin Fowler on the Unit of Work Pattern. Frankly, I am not sure what the difference is between UoW and the concept of a database Transaction. Most simple SQL operations are auto-commit so there is no need for the developer to explicitly bracket the code within a transaction. With multiple SQL operations (such as a bank transfer or a purchase of a shopping cart full of products) the developer needs to bracket the operations within a Transaction and they either 1) all succeed (Commit) or 2) all fail (Rollback). These are relational database principles that have been around for a long time. So, my question is what is UoW adding to this principle or how does it differ? Trey H. Trey Henlon, Apr 01, 2013
|
|
Reply 1Hi Trey H
I think its one of those patters that's useful to understand but one that you wont write from scratch yourself. I believe that its used in a number of persistence frameworks for eg Entity Frameworks ObjectContext and NHibernate uses UoW patterns (I think, someone can correct me if wrong) Tony Anthony Joanes, Apr 05, 2013
|