且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将字段添加到先前查找的表中后,更新实体框架模型

更新时间:2023-12-01 21:14:16

你以前有一个映射,现在你有一个新的实体。

You used to have a mapping, and now you have a new entity.

你可能会必须删除设计器中的Action和Requirement之间的关系。然后从数据库更新您的模型,并确保在添加选项卡的分支中检查查找表。那么你应该有一个基于查找表的新实体,并且 Action 要求实体将与该实体(而不是彼此直接映射)。

You'll probably have to delete the relationship between Action and Requirement in the designer. Then update your model from the database, and make sure the lookup table is checked in the Tables branch of the Add tab. Then you should have a new entity based on the lookup table, and the Action and Requirement entities will have a relationship with that entity (instead of having a direct mapping to each other).

如果查找表未显示在更新向导中,则可以尝试手动删除任何引用到 .edmx 文件中的表。

If the lookup table doesn't show up in the update wizard, you might try manually deleting any reference to the table in the .edmx file.