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
The same thing happened to me. I had a table with a string value but I wanted to change this to a foreign key so that I could store the reoccurring string values in a separate table. So I created a new table and I changed the string column type to a not nullable int and added a foreign key. When I updated the model, it marked all entity classes as deleted... not funny.
I also saw some errors popping up indicating that EF didn't change the column type from string to int.
The solutions mentioned above (the custom tool and transforming all templates) did not work for me.
For me the solution was to change the column type from string to int manually in the model first and then updating the model, no more issues occured.
For the record: this happened in EF 4 in Visual Studio 2010.