Created
August 12, 2013 10:33
-
-
Save FernandoVezzali/6209785 to your computer and use it in GitHub Desktop.
TransactionScope Entity Framework 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using(var scope = new TransactionScope(TransactionScopeOption.Required, | |
new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted })) | |
{ | |
// Do something | |
context.SaveChanges(); | |
// Do something else | |
context.SaveChanges(); | |
scope.Complete(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Enabling network DTC access: http://stackoverflow.com/questions/794364/how-do-i-use-transactionscope-in-c