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