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