How do you explicitly tell EF that the table is in a specific schema?
For example, the AdventureWorks database defines the Production.Product table. When using the OnModelCreating method OnModelCreating I use the following code:
protected override void OnModelCreating(DbModelBuilder modelBuilder) { EntityTypeConfiguration<Product> config = modelBuilder.Entity<Product>(); config.HasKey(p => p.ProductID); config.Property(p => p.Price).HasColumnName("ListPrice"); config.ToTable("Product"); }
However, when it starts, it says that it is Invalid object name: dbo.Product .
I tried:
config.ToTable("Production.Product"); //and config.HasEntityName("Production");
but both of them do not work either.
source share