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