public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <BiDbContext>(options => { if (options.ExistingConnection != null) { BiDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { BiDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); // Configure second DbContext Configuration.Modules.AbpEfCore().AddDbContext <SecondDbContext.SecondDbContext>(options => { if (options.ExistingConnection != null) { SecondDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { SecondDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }
public override void PreInitialize() { Configuration.ReplaceService <IConnectionStringResolver, MyConnectionStringResolver>(); if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <TwoContextsDbContext>(options => { if (options.ExistingConnection != null) { TwoContextsDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { TwoContextsDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } // Configure second DbContext Configuration.Modules.AbpEfCore().AddDbContext <TEST1Context>(options => { if (options.ExistingConnection != null) { SecondDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { SecondDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); }