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