无法在没有主键的实体模型中添加表

发布于 2024-12-23 14:01:57 字数 53 浏览 3 评论 0原文

我在使用实体数据模型时遇到问题。我无法在实体模型中添加没有主键的表。具有组合键的表也是如此。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

做个ˇ局外人 2024-12-30 14:01:57

对于复合键肯定你错了,但对于第一个,像实体框架这样的框架如何知道哪一行已被更新、删除,而它无法通过主键识别行,

即使在该表中你可以有精确的重复行。

对于第一个,请检查这个问题

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

断爱 2024-12-30 14:01:57

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文