必须指定所有键属性的映射 [英] Must specify mapping for all key properties
问题描述
您好,
我遇到了一个新问题,我一直在我的一个项目中使用实体框架。今天我遇到了sql的一个表,这个表是由很久以前从事该项目的人创建的。
该表没有主键列所以我决定添加1,然后我在我的解决方案中更新了EDMX文件,但它现在不断抛出此错误:
必须指定所有关键属性的映射。
我放弃了桌子并重新创建但是这个错误根本没有消失。
我真的很感激一些帮助这个。
谢谢。
我尝试了什么:
谷歌问题。
删除当前的EDMX并导入新的1.
重建/清理解决方案。
Hi There,
I am faced with a new issue, I have been using entity framework in one of my projects for quite sometime. Today I came across a table in sql that was created by someone who worked on the project a long time ago.
The table had no Primary Key column so I decided to add 1 in, I then updated the EDMX file in my solution but it now keeps throwing up this error:
Must specify mapping for all key properties.
I dropped the table and recreated but this error is not going away at all.
I would really appreciate some help on this.
Thanks.
What I have tried:
Google the issue.
Delete the current EDMX and import a new 1.
Rebuild/Clean the solution.
推荐答案
首先,你必须udpate(重新创建).edmx
来自架构(数据库)的文件。
如何?在 EF Designer [ ^ ] - 右键单击 - >从数据库更新模型
。
如果不起作用,请按以下步骤操作:
手动编辑.edmx文件(实体框架) [ ^ ]
EDM - 必须指定实体集的所有关键属性的映射 [ ^ ]
祝您好运!
First of all, you have to udpate (recreate).edmx
file from schema (database).
How? In the EF Designer[^] - right-click ->Update Model from Database
.
In case it won't help, please follow these:
Editing an .edmx File Manually (Entity Framework)[^]
EDM - Must specify mapping for all key properties of entity set[^]
Good luck!
从XML文件中删除关联因为它没有被删除/更新在数据库中删除/更新关联时自动启动。
Deleted association from the XML file since it was not being deleted/updated automatically when the association was deleted/updated in the database.
从模型浏览器中移除特定表..在model.store和实体中。
之后再添加相同的表..它将起作用
remove the particular table from model browser..in both model.store ande entity .
After that add again the same table..it will work
这篇关于必须指定所有键属性的映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!