protected void Persist(Action action) { var dbContext = ContainerLocal.Resolve <ThingDbContext>(); var tx = dbContext.Database.BeginTransaction(); try { action(); dbContext.SaveChanges(); tx.Commit(); } catch (Exception) { tx.Rollback(); throw; } finally { UndoingChangesDbContextLevel(dbContext); } }
protected override object CustomCtorFactory(Type t) { return(ContainerLocal.Resolve(t)); }
protected void Do(Action <ThingDbContext> action) { var dbContext = ContainerLocal.Resolve <ThingDbContext>(); action(dbContext); }