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