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