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