public AccountUnitOfWorkContext() { var options = EngineContext.Current.Resolve <DbContextOptions <AccountContext> >(); AccountContext = new AccountContext(options); AccountContext.ChangeTracker.LazyLoadingEnabled = false; }
public static void Initialize(IServiceProvider serviceProvider = null) { DbContextOptions <AccountContext> options = null; if (serviceProvider != null) { options = serviceProvider.GetService <DbContextOptions <AccountContext> >(); } else { options = EngineContext.Current.Resolve <DbContextOptions <AccountContext> >(); } var accountContext = new AccountContext(options); accountContext.Database.Migrate(); }