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