public MyLifeDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <MyLifeDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); MyLifeDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyLifeConsts.ConnectionStringName)); return(new MyLifeDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <MyLifeDbContext>(options => { if (options.ExistingConnection != null) { MyLifeDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { MyLifeDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }