Entity Framework Not Saving / Stop database being rebuilt

大兔子大兔子 提交于 2019-12-05 22:17:56

So I end up taking the advice above an creating a new project unfortunately that did not work. 10 hours of Googling later and I found the solution. I a suspected the database was being rebuilt.

To prevent a database being rebuilt right click on it in the solution explorer and go to properties. Under properties find the property Copy to output directory and change the value to Do not copy.

This actually broke my code because the database was not in the output directory. To get the program to work again I had to manually put a copy of the database in my debug directory. For my project. In Windows 8 with Visual Studio 2012 this was located at:

%UserProfile%\Documents\Visual Studio 2012\Projects\PROJECTNAME\PROJECTNAME\bin\Debug

Hope this saves others searching the Internet for hours on end.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!