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