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