How do I remove underscore of foreign key fields in code first by convention

前端 未结 7 933
傲寒
傲寒 2020-11-30 01:20

I\'ve got multiple classes (including TPT) in my project. Each POCO has a BaseClass, which has a GUID (called GlobalKey) as primary ke

7条回答
  •  粉色の甜心
    2020-11-30 01:46

    Most of these answers have to do with Independent Assocations (where the "MyOtherTable" navigation property is defined, but not the "int MyOtherTableId") instead of Foreign Key Assocations (where both are defined).

    That is fine since the question is about IA (it uses MapKey), but I came across this question when searching for a solution to the same problem with FKAs. Since other people may come here for the same reason, I thought I would share my solution that uses a ForeignKeyDiscoveryConvention.

    https://stackoverflow.com/a/43809004/799936

提交回复
热议问题