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