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