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