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