Entity Framework 6.0.2 to 6.1.3 upgrade fails when matching entities mapped with the same table name but with a different schema
I have a project that uses entity framework (EF) 6.0.2 which is currently in use. I have used code and custom maps for my entities. After upgrading to EF 6.1.3, when I try to run the project, it shows me the following error:
The StoreAuditLog and Store object types cannot share the Stores table because they are not in a hierarchy of the same type or do not have a valid one-to-one foreign key relationship with their respective primarys between them.
The corresponding mappings for these objects:
public class StoreAuditLogMap : EntityTypeConfiguration<StoreAuditLog>
{
public StoreAuditLogMap()
{
// ... Removed for simplicity
ToTable("Stores", "audit");
}
}
public class StoreMap : EntityTypeConfiguration<Store>
{
public StoreMap()
{
//... Removed for simplicity
ToTable("Stores");
}
}
which work correctly with EF version 6.0.2. Entities have no connection with each other.
According to the EF documentation, the ToTable ("tableName") method creates tables in the "dbo" schema. But if I do not specify the "dbo" schema in StoreMap, an error occurs
Is this some kind of EF 6.1.3 bug? Why does the code work correctly using version 6.0.2 EF? EF shouldn't continue to create Store table in "dbo" schema like in 6.0.2? Why do I need to change the mapping to pass a value that should be the default?
source to share
No one has answered this question yet
Check out similar questions: