Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheritance and renamed tables #49

Open
alexsteeel opened this issue Oct 25, 2021 · 0 comments
Open

Inheritance and renamed tables #49

alexsteeel opened this issue Oct 25, 2021 · 0 comments

Comments

@alexsteeel
Copy link

alexsteeel commented Oct 25, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant