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?

+3
c # database-schema ef-code-first entity-framework-6


source to share


No one has answered this question yet

Check out similar questions:

758
Entity Framework 5 Record Update
12
Splitting tables of Entity structure: not in a hierarchy of the same type / have no valid one-to-one foreign key relationship
7
Same table named different schema
6
\ Cannot map an entity to a table if another entity has the same name as the table
4
Entity Framework 4.1 First Code Mapping to Tables That Use the Primary Key as a Foreign Key Column
1
How to force Entity Framework to map the correct foreign key relationship when creating tables
1
What arbitrary length limit does Entity Framework 6.1.3 impose on you?
0
Two objects with the same table name
0
Entity Framework 6.1.3; first code jumps to many of the joined tables
0
Entity Framework 6: two unrelated entities mapped to one table



All Articles
Loading...
X
Show
Funny
Dev
Pics