Why is my edmx file not updating

前端 未结 7 1674
傲寒
傲寒 2021-02-14 12:01

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:

相关标签:
7条回答
  • 2021-02-14 12:21

    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.

    0 讨论(0)
  • 2021-02-14 12:23

    I faced the same issue. The most reasonable solution could be to delete .edmx file and to regenrate it. Keep in mind that you should always try to update model first if nothing work then do what I just said.

    0 讨论(0)
  • 2021-02-14 12:27

    Make sure that you selecting the objects from Update tab

    0 讨论(0)
  • 2021-02-14 12:29

    When faced with this issue, i solved my by change the username and password...so i would say, make sure you have a valid connection string in your edmx

    0 讨论(0)
  • 2021-02-14 12:37

    I've had this issue on a number of occasions. For simple problems I've edited the edmx file by opening in the code editor ( Open With... > Source Code (Text) Editor ).

    Locate the table by looking for by searching for EntityType Name="your table name".

    Typically I see an entry that doesn't look right, delete it, save and close the file. Open the edmx the usual way and refresh the model and Presto problem solved.

    0 讨论(0)
  • 2021-02-14 12:41

    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.

    0 讨论(0)
提交回复
热议问题