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