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); } }); } }