You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is the same keys, except for the name.
As far as I could figure it out, this is because the key for owned-type points to the primary key for Car. But the Id field flies into TransportBase, so ef starts thinking the owner is in another table and creates a foreign key.
How can I fix it?
I tried to set shadow property, which will be principal key, but it creates unnecessary columns in table.
The text was updated successfully, but these errors were encountered:
File a bug
I found the original issue on Stackoverflow here:
https://stackoverflow.com/questions/75614840/entity-framework-core-creates-unnecessary-foreign-key-for-owned-type-when-using
I have the same issue, so I am pasting issue here:
When I configure any owned type in TPT child entity, ef creating additional foreign key to parent table.
I have configuration like this:
And it generates these constraints in table "cars":
It is the same keys, except for the name.
As far as I could figure it out, this is because the key for owned-type points to the primary key for Car. But the Id field flies into TransportBase, so ef starts thinking the owner is in another table and creates a foreign key.
How can I fix it?
I tried to set shadow property, which will be principal key, but it creates unnecessary columns in table.
The text was updated successfully, but these errors were encountered: