Skip to content

Inheritance and renamed tables #49

@alexsteeel

Description

@alexsteeel

Hello!

I have added tests for three inheritance cases for EF6 in pull request #48.

  1. Added the Parent and Child classes. Only test BulkInsert_OnlyParent_OneRowInserted runs correctly. How do I correctly insert both parent and child? Other tests fail.
  2. Added test BulkInsertApChild_OneRowInserted with abstract class for TPT checking (Inheritance with EF Code First: Part 2 – Table per Type (TPT)).
  3. The table name is specified in the Table attribute. Test BulkInsertChild_RenamedParentExists_OneRowInserted throws an exception. An attempt is made to write the value of one column to another in the MapperBase class.

In method MapEntity only properties of the child class are selected:

var propertiesToMap = GetPropertiesToMap(entityMap, storageEntitySet.ElementType.Properties);
foreach (var edmProperty in propertiesToMap)
{
    MapProperty(entityMap, edmProperty, ref i, ref prefix);
}

image

In the MapProperty method the properties of the parent class are also selected:
var entityMembers = TphData[identity].Properties;

And here is the assignment of an incorrect value:
EdmMember edmMember = entityMembers[i];
image

Is it possible in the MapProperty method to select edmMember not by index, but by key?

Sincerely, Alexander

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions