无法在没有主键的实体模型中添加表
我在使用实体数据模型时遇到问题。我无法在实体模型中添加没有主键的表。具有组合键的表也是如此。
I have a problem in using Entity data model. I'm unable to add a table in entity model that has no primary key. The same situation is with the table that has composite key.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于复合键肯定你错了,但对于第一个,像实体框架这样的框架如何知道哪一行已被更新、删除,而它无法通过主键识别行,
即使在该表中你可以有精确的重复行。
对于第一个,请检查这个问题
For composite keys sure you are wrong but for the first one How could a framework like Entity Framework could know which row has been updated, deleted while it can not identify the row by a primary key,
even in that tables you can have exact duplicate rows.
For the first one check this question
1.更改表结构并添加主列。更新模型。
2. 在 XML 编辑器中修改 .EDMX 文件,并尝试在该特定表的标记下添加新列。 (不会工作)
3.我将通过涉及所有现有列来创建一个复合键,而不是创建一个新的主列到退出表。(已工作)
实体框架:将没有主键的 DataTable 添加到实体模型。
1.Change the Table structure and add a Primary Column. Update the Model.
2.Modify the .EDMX file in XML Editor and try adding a New Column under tag for this specific table. (WILL NOT WORK)
3.Instead of creating a new Primary Column to Exiting table, i will make a composite key by involving all the existing columns.(WORKED)
Entity Framework: Adding DataTable with no Primary Key to Entity Model.