public class FirstDbContext : DbContext
{
public FirstDbContext(DbContextOptions options)
: base(options)
{ }
public DbSet xxxs{ get; set; }
public DbSet xxxs{ get; set; }
}
public class SecondDbContext : DbContext
{
public SecondDbContext (DbContextOptions options)
: base(options)
{ }
public DbSet xxxs{ get; set; }
public DbSet xxxs{ get; set; }
}
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
var connection = @"xxx";
services.AddDbContext
(options => options.UseSqlServer(connection));
var secondDbconnection = @"xxx";
services.AddDbContext
(options => options.UseSqlServer(secondDbconnection));
}
Add-Migration InitialCreate -Context FirstDbContext -OutputDir Migrations\FirstDbContextMigrations
Update-Database -Context FirstDbContext