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