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