Entity Framework Table Per Hierarchy restrictions

476 views Asked by At

I have very big table in my Database and a can't modify it. So i have BaseEntity type for table.

I have several children (entity1, entity2) and i'd like to map each type to same column ("Date") and name properties differently.

Surely i can't move all same column properties to base type cause there is about 100 columns in my super table (it's not my design i've jst need to map it)

So i have 0019 error and is there any way to solve it or EF not for me?

1

There are 1 answers

1
Ladislav Mrnka On BEST ANSWER

No. TPH requires that each property defined in derived entity is exclusive for that entity (no other entity can map to the same column). This targets more general rule in EF - each column can be mapped only once. So if you need to use some column in more entities it must be defined in parent and must have same name in all child entities.