C# – Why is the edmx file not updating

asp.netcentity-framework

I have a database first ASP.NET MVC 5 EF6 project. I'm using VS2015 CE. When I change my database (SQL Server 2012), I then go to VS to update my edmx file like this:

  • Double click on the edmx file in the solution explorer
  • In the edmx file right click on a blank space and select the option 'Update Model From Database'
  • I click on the button 'Finish'
  • I Rebuild the solution

When I have a table with the columns ID, Column1, Column2 and I changed Column2 into Column2Changed, my edmx has a model with ID, Column1, Column2, Column2Changed instead of ID, Column1, Column2Changed.

Also, when I change the datatype for a column, this change is not applied in my edmx.

Best Answer

This is a well-known problem with Entity Framework.

"Update Model from Database" continues to be a hit-and-miss affair. Sometimes it works, often it doesn't.

Personally, I just delete the "updated" table from my .edmx file, then re-add it. Then it seems to be work okay.