We are using Entity Framework, Code First and in our database we have several tables that have the same name but in different Schemas.
I have also put the models in two different namespaces.
How i can register these tables in my DbContext class?
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Data.Schema1.Contact>().ToTable("Contact", "schema1");
modelBuilder.Entity<Data.Schema2.Contact>().ToTable("Contact", "schema2");
}
Thanks for your help in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…