Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我在数据库中添加或更改字段,如何更新我的 .edmx 文件?我是否运行“从数据库更新模型”,是否需要删除 .tt 文件并运行新的“添加代码生成项”?
我是否需要对我的 MVC 项目文件进行任何其他更改以使其与数据库更改保持同步?
很多问题!
是的,您可以运行更新模型 - 有时(如果您重命名一个字段)您将不得不手动修改模型 - 删除旧字段,或者您可以在点击更新模型之前删除整个实体。
您无需删除 .tt 文件并运行添加代码生成位。
您可能需要右键单击 .tt 并选择“运行自定义工具”来告诉 .tt 文件重新生成模型类。