为什么我的edmx文件没有更新 [英] Why is my edmx file not updating
问题描述
我有一个数据库第一个ASP.NET MVC 5 EF6项目。我正在使用VS2015 CE。更改数据库(SQL Server 2012)时,然后去VS更新edmx文件,如下所示:
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:
- 双击解决方案资源管理器中的edmx文件
- 在edmx文件中,右键单击空白,然后选择从数据库更新模型选项。
- 我单击在完成按钮上
- 我重建解决方案
- 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
当我有一张桌子列ID,Column1,Column2和我将Column2更改为Column2Changed,我的edmx有一个具有ID,Column1,Column2,Column2Changed的模型,而不是ID,Column1,Column2Changed。
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.
另外,当我更改列的数据类型时,此更改不会应用到我的edmx中。
Also, when I change the datatype for a column, this change is not applied in my edmx.
推荐答案
从数据库更新模型仍然是一个偶然的问题。
"Update Model from Database" continues to be a hit-and-miss affair. Sometimes it works, often it doesn't.
个人而言,我只是从.edmx文件中删除已更新表,然后重新添加。这样看来工作还可以。
Personally, I just delete the "updated" table from my .edmx file, then re-add it. Then it seems to be work okay.
这篇关于为什么我的edmx文件没有更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!