Entity Framework transaction scope examples
I just posted examples on how to use transaction scopes with entity framework on my programming interviews blog.
In this post, I cover three cases in which transaction scope is being used to show rollback when an error occurs during an update of multiple entities:
- when you have multiple save calls to the context;
- when you have single save with multiple object; and
- transactions across multiple contexts.
Check it out and share your feedback.
Comments
Anonymous
June 07, 2012
Hello! Couldn't you also try to show how to flow a transaction in and use it inside an asynchronous WCF activity, please? Best regards, Henrik DahlAnonymous
February 07, 2013
using(TransactionScope scope = new TransactionScope()) { // Your code scope.Complete(); // To commit. }Anonymous
January 09, 2014
your sample that involves multiple datacontext will it work without MSDTC