public void Execute(Class context, Action next) { using (ContainerLocal.Create()) { Debug.WriteLine(" Start " + nameof(InitializeTestClass)); next(); Debug.WriteLine(" End " + nameof(InitializeTestClass)); } }
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); }