问题描述
,创建外键关联的步骤如下:
...一定要检查添加外部填写关系详细信息时,实体复选框的关键属性。
另请参见:
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 create a database first model. Now I want to create a foreign key relationship between ProductId and ProductId (see below). I looked at the "add new association" but I cannot connect the two items. Can someone more experienced tell me how to accomplish this?
According to Relationships/Associations with the EF Designer, the steps to create a foreign key association are:
...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
这篇关于如何在Entity Framework中添加外键关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!