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