using (dbcontext = new DBContext()) { //read from context here //modify context here using (transactionscope = new TransactionScope()) { dbcontext.SaveChanges(); dbcontext.Database.ExecuteSQLCommand("UPDATE table..."); transactionscope.Complete(); } }
using (transactionscope = new TransactionScope()) { using (dbcontext = new DBContext()) { //read from context here //modify context here dbcontext.SaveChanges(); dbcontext.Database.ExecuteSQLCommand("UPDATE table..."); } transactionscope.Complete(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)