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