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