更新概念模型

发布于 2024-10-29 09:09:12 字数 116 浏览 0 评论 0原文

我已经从数据库生成了 EDM。后来我从数据库中删除了一列,一旦我更新了模型,该列的实体属性仍然存在。我还注意到,即使您更改列类型并刷新模型,模型中的实体也不会被修改。 有没有办法刷新 EDM 并应用数据库中所做的更改?

I have generated EDM from DB. Later I have removed a column from a DB and once I have updated the model the property in entity for that column is still there. Also I have noticed that even if you will change a column type and refresh the model the Entity in model is not modified.
Is there a way to refresh EDM and apply changes done in DB?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

于我来说 2024-11-05 09:09:12

在大多数情况下,数据库更改将被推送到概念模型,删除列是一种特殊情况。如果模型刷新包含此功能,那么它可能会意外删除您独立添加到概念模型中的属性 - 这将是一件坏事。

要删除过时的列,只需在设计器中突出显示它并按删除键即可。如果您可以编辑 CSDL,您还可以删除 edmx 文件中的列。

DB changes will be pushed through to the conceptual model in most cases, removing a column is a special case. If the model refresh included this feature, then it might accidentally remove properties that you had added to the conceptual model independently - that would be a bad thing.

To remove an obsolete column, just highlight it in the designer and hit the delete key. You can also remove the column in the edmx file if you can handle editing CSDL.

So要识趣 2024-11-05 09:09:12

当您更新 EDM 时,它仅更新数据库定义,而不更新概念模型。之后您可能会收到错误,抱怨映射失败。您仍然有一个不再映射到数据库属性的概念属性。请记住,EDM 包含三个部分。只有第一次,概念模型是基于数据库模型创建的,并且两者通过映射模型链接在一起。之后,更新 EDM 时,仅刷新数据库模型。您必须手动删除/重新定义属性类型。

When you update the EDM it only updates the database definition not the conceptual model. Probably you get errors afterwards complaining about a mapping failure. You still have a conceptual property that doesn't map to a database property anymore. Remember that the EDM has three parts in it. Only the first time the conceptual model is created based upon the database model and the two are linked together by the mapping model. Afterwards, when updating the EDM, only the database model is refreshed. You have to delete / redefine types of properties by hand.

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