How to add foreign key relationship in Entity Framework?

后端 未结 3 1875
灰色年华
灰色年华 2020-12-04 14:19

Click here to see how to do it while using a code first approach. Below the original database first approach question and answer.

I am using Entity Designer to creat

3条回答
  •  醉酒成梦
    2020-12-04 14:42

    According to Relationships/Associations with the EF Designer, the steps to create a foreign key association are:

    1. Right-click an empty area of the design surface, point to Add New, and select Association….
    2. Fill in the settings for the association in the Add Association dialog.

    ...being sure to check the Add foreign key properties to the Entity checkbox when filling in the relationship details.

    See also: Relationships, Navigation Properties, and Foreign Keys

提交回复
热议问题