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:
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.
Delete existing model and then update: Delete key to delete all models in the designer. IMPORTANT: Do not save the EDMX at this point if you are using TFS for source control!* Now right-click and select "Update Model from Database" to recreate the entire model again. Rebuild project to propagate changes.
An . edmx file is an XML file that defines an Entity Data Model (EDM), describes the target database schema, and defines the mapping between the EDM and the database. An . edmx file also contains information that is used by the ADO.NET Entity Data Model Designer (Entity Designer) to render a model graphically.
Right-click on your EDMX file, select Open With…, then select XML (Text) Editor. Boom, there is your entire EDMX file as Visual Studio and . Net sees it, in all its XML wonderfulness.
This worked for me :
1.Build the project after updating EDMX file.
2.Right click your .tt file in solution explorer.
3.Select "Run Custom Tool" option.
This will update the .tt file.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With