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