[Stack Overflow Issue 1](http://stackoverflow.com/q/13179634/1791547)
[Stack Overflow Issue 2](http://stackoverflow.com/q/10961690/1791547)
EF throws a configuration error when trying to map a Table Per Type model where the _Derived type contains a composite foreign key_ to another type, but one part of the _composite key is defined in the Base Type_ as a composite _primary key._
The main problem seems to be that EF does not see that TenantID is going to be in the derived table. And ordinarily it would be right, but in this case, TenantID is part of the key so will actually be in both tables.
This type of derived type mapping seems perfectly normal and it works perfectly fine without this composite key situation. So this seems like a bug.
Comments: Is this a Code-First or a general EF limitation? I'm wondering because here on Stackoverflow (http://stackoverflow.com/questions/13953675/modelling-polymorphic-associations-database-first-vs-code-first) is a question with a similar model (association in derived class, but FK property in base class) which - according to the question owner - works with an EDMX-based model, but not with Code-First.
[Stack Overflow Issue 2](http://stackoverflow.com/q/10961690/1791547)
EF throws a configuration error when trying to map a Table Per Type model where the _Derived type contains a composite foreign key_ to another type, but one part of the _composite key is defined in the Base Type_ as a composite _primary key._
The main problem seems to be that EF does not see that TenantID is going to be in the derived table. And ordinarily it would be right, but in this case, TenantID is part of the key so will actually be in both tables.
This type of derived type mapping seems perfectly normal and it works perfectly fine without this composite key situation. So this seems like a bug.
Comments: Is this a Code-First or a general EF limitation? I'm wondering because here on Stackoverflow (http://stackoverflow.com/questions/13953675/modelling-polymorphic-associations-database-first-vs-code-first) is a question with a similar model (association in derived class, but FK property in base class) which - according to the question owner - works with an EDMX-based model, but not with Code-First.