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