Search code examples
c#visual-studio-2012entity-framework-5

why does visual studio delete my classes when I update entity framework model


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.

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.

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.

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.

Any ideas out there?

Thanks!


Solution

  • 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.