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