向数据库中的表添加字段 - 如何使实体 edmx 响应?
我尝试重建,但 edmx 文件似乎不会随着我所做的更改而自行更新。除了删除 edmx 并重新制作之外,还有什么建议吗?
I tried rebuilding but it seems that the edmx file doesn't update itself with the changes I made. Any suggestions besides removing the edmx and remaking it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以手动添加该字段。这并不难,特别是如果它是一个标量。
现在,如果需要,您可以通过重新打开模型来编辑 GUI 中的新字段。
You can add the field manually. It's not so hard, especially if it's a scalar.
Now you can edit the new field in the GUI by re-opening the model, if need be.
如果您使用的是 Entity Framework 4.0,则只需右键单击设计器中的空白区域,选择“从数据库更新模型”,然后单击“完成”。这将刷新所有表。
If you are using Entity Framework 4.0 you can just right-click the white-space in the designer, choose 'Update Model from Database' and hit Finish. This will refresh all tables.