Entity Framework (Database-First) multiple relations to same table naming conventions control

前端 未结 3 567
小鲜肉
小鲜肉 2021-02-18 19:24

Let\'s suppose that we have this situation:

Tables in database:

Country (id, country_name), Person (id, login), CountryManager (id_country, id_person), Cou

3条回答
  •  被撕碎了的回忆
    2021-02-18 20:04

    I recommend using https://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838

    It allows more flexibility than any database generation thing I've seen. I'm still working on solving my own problem, but this looks pretty promising. But, unlike the Default Code generation that EF provides, you can customize the mapping.

    Like, in all the examples I've seen on renaming the navigation properties -- that alone won't be enough, because EF still needs to be mapped to use those navigation properties (you could hack it though, and have your User2 point to ModifiedByUser, for example).

提交回复
热议问题