How to use transactions with the Entity Framework? -


When you have such a code:

  something = something new (); BlahEntities b = new BlahEntities () b.AddToSomethingSet (some); B.SaveChanges ();  

What extra work does the transaction work?

You can enter your code in the

  field of transactions (Transaction Scope Scope = New Transaction ()) {// Your Code is scope.Complete (); //  to commit. }  

The TransactionScope System.Transactions are located in the namespace, which is located in the assembly of the same name (which you may have to manually add to your project).


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -