无法在Entity Framework 4中手动添加外键

时间:2022-05-21 11:29:39

So I have a sql server 2008 database with 9 tables in them, they don't have any set relationships but is still used as if they have it, this however makes it so that I cant import the relationships when importing the models from the database.

所以我有一个sql server 2008数据库,其中包含9个表,它们没有任何设置关系,但仍然像使用它一样使用,但这使得我无法从数据库导入模型时导入关系。

Now, when trying to add an association between two tables work but when I want to point tb1.Id -> tb2.fkid it forces tb1.Id -> tb2.Id instead, I'm unable to choose anything else besides Id in both tables and I cant delete them either (from the menu after clicking the association line between the tables).

现在,当试图在两个表之间添加关联时,但是当我想指向tb1.Id - > tb2.fkid时它会强制tb1.Id - > tb2.Id而不是我在两者中都无法选择除Id之外的任何其他内容。表格和我不能删除它们(单击表格之间的关联线后从菜单中)。

So is it possible to make these "fake" relationships? if so what am I missing?

那么有可能建立这些“假”关系吗?如果是的话,我错过了什么?

1 个解决方案

#1


0  

After some more looking into it I found the answer, clicking on the association line and choose table mapping, then I started to fiddle around and it enabled me to choose the right column.

经过一番研究后,我找到答案,点击关联线并选择表格映射,然后我开始摆弄它,这使我能够选择正确的列。

#1


0  

After some more looking into it I found the answer, clicking on the association line and choose table mapping, then I started to fiddle around and it enabled me to choose the right column.

经过一番研究后,我找到答案,点击关联线并选择表格映射,然后我开始摆弄它,这使我能够选择正确的列。