The same thing happened to me. I had a table with a string value, but I wanted to change it to a foreign key so that I could store duplicate string values ββin a separate table. So I created a new table, and I changed the column type of the row to an invalid int and added the foreign key. When I updated the model, it marked all entity classes as deleted ... not funny.
I also saw some errors appearing indicating that EF did not change the column type from row to int.
The solutions mentioned above (custom tool and conversion of all templates) did not help me.
For me, the solution was to first change the column type from row to int manually in the model, and then update the model, there were no more problems.
For the record: this happened in EF 4 in Visual Studio 2010.
source share