This project has moved. For the latest updates, please go here.
1
Vote

Multiple Tables Same Name, Different Schema - Bug

description

I am using DatabaseFirst / EF6.1 and I have found an issue with the mapping API when multiple tables have the same name, but exist in different schemas. EF will generate an entity set name mapping as follows:

Table => entityset => C# class
schema.entity => "entityset" => schema1entity
schema2.entity => "entityset1" => schema2entity
schema3.entity => "entityset2" => schema3entity

for schema1entity everything works, for schema2entity and others, the Mapping API will fail due to the following:
protected override PrepareMappingRes PrepareMapping(string typeFullName, EdmType edmItem)

<code removed for example>

tableName = GetTableName( schema2EntityType )  -> tableName = "entity"

<code removed for example>

while (!EntityContainer.TryGetEntitySetByName(tableName, false, out storageEntitySet))
it seems that the code will call TryGetEntitySetByName using the database table name, when it should be the entity set name.

comments