Categories
Database Development

Nested transactions are not supported entity framework

I’m trying to wrap up saving data to tables in a transaction like so : using (var context = new StDbContext()) { context.Database.Log = Console.Write; context.Database.Connection.Open(); using (DbTransaction transaction = context.Database.Connection.BeginTransaction()) { try { var unit_of_work = new UnitOfWork(context); unit_of_work.Sessions.AddModelSession(); context.SaveChanges(); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); TestBaseCore.mNLogLoggerService.Error(ex.Message); } } } Inside unit_of_work.Sessions.AddModelSession(); I’m […]