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