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