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

前端 未结 3 563
小鲜肉
小鲜肉 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:19

    In VS you can do this with the GUI.

    If you show Model Browser then navigate down the tree to:

    YourEntityModel > Entity Types > Country

    then right-click on the "Person1" Navigation Property and select "Properties" you can then change the name of the navigation property name to whatever you like:

    enter image description here

    Just change the name, save changes and your done...

    (Actually there are lots of ways to get to the Navigation Property properties window - you cn right click on it in the model diagram too)

提交回复
热议问题