How Can saveChanges twice inSide Two Diferrent DBcontext (Two different Entities framwork)
try
{
using (var context = new DBContext())
{
using (var DBtran= context.Database.BeginTransaction())
{
//something
using (var context2 = new DBContext2())
{
using (var DBtran2= context2.Database.BeginTransaction())
{
//someThing
savechanges();
DBtran2.commit();
saveChanges();
DBtran.commit();
}
}
}
}
}
catch(Exception e)
{
DBtran.RollBack();
}
in my code I wan't to save data to Table into Dbcontext (Entity1) then I wan't to save the rest of data to table into Dbcontext 2 (Entity2)