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