How can I use TPT inheritance models when primary keys have different names?

后端 未结 1 338
孤独总比滥情好
孤独总比滥情好 2021-01-03 10:30

Using Entity Framework 4.1 against a legacy database, I\'m unable to generate a working set of TPT inheritance models that aren\'t pluralized and use different names for a c

相关标签:
1条回答
  • 2021-01-03 11:34

    I described TPT mapping here. It is step by step so it should work but you need to map Ids in child entities.

    But the issue is that you start with Model-first, generate DdContext which is dependent on EDMX, then delete that EDMX and start defining mapping by yourselves. You should decide if you want to use Model-first or Code-first. You just wasted your effort in EDMX.

    If you want to know how to use Model-first with DbContext check this article. If you want to use Code-first don't create EDMX and follow this article to map your inheritance.

    0 讨论(0)
提交回复
热议问题