为什么在更新实体框架模型时Visual Studio会删除我的类 [英] why does visual studio delete my classes when I update entity framework model

查看:84
本文介绍了为什么在更新实体框架模型时Visual Studio会删除我的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新EF模型(版本5)时遇到一个奇怪的问题。它将删除属于该模型的所有类。

I'm having a strange problem when I update my EF model (ver 5). It deletes all of the classes that belong to that model.

我的情况是这样的。我更改了两个表的键列,这些键引用了我的主表。更新模型并没有对edmx进行这些更改,因此我删除了这三个表(主表和两个查找表),保存了edmx。然后更新模型并重新添加这些表。

My situation was like this. I changed the key column of two tables which have references to my primary table. Updating the model did not make these changes to the edmx, so I removed those three table (primary and two lookup tables), saved the edmx. Then updated the model and added those tables back in.

更新模型后,一旦我保存了模型,VS就会删除此edmx的所有类文件。 edmx的所有表看起来都还不错,只是类已经消失了。然后,我必须还原最近的更改,然后重试。

Once I saved the model after updating it, VS deleted all of the class files for this edmx. The edmx still looks alright with all of the tables, just the classes have gone. I then have to revert my last changes and try again.

要做的一件事是手动编辑edmx文件,以对受影响的类进行适当的更改,但是我

One thing that did work was manually editing the edmx file to make the appropriate changes to the affected classes, but I don't see why I should have to do that.

这里有任何想法吗?

谢谢!

推荐答案

已经很长时间了,但最后我发现我的edmx文件有一些错误,但我没有可见,这导致未生成poco类文件。

It's been a long while, but in the end it turned out I had some errors in my edmx file which I hadn't seen, and that was causing the poco class files to not be generated.

这篇关于为什么在更新实体框架模型时Visual Studio会删除我的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆