自创建数据库以来,支持"POSContext"上下文的模型已更改 [英] The model backing the 'POSContext' context has changed since the database was created
问题描述
我正在使用数据库优先方法在Visual Studio 2012中使用entityframework开发winform应用程序.突然我遇到以下错误:-
I am developing winform application using entityframework in visual studio 2012 with database first approach. Suddenly I am facing the following error:-
自创建数据库以来,支持"POSContext"上下文的模型已更改.考虑使用代码优先迁移来更新数据库( http://go.microsoft.com/fwlink/?LinkId = 238269 ).
The model backing the 'POSContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).
可以请立即帮助我解决此问题.我将非常感谢及时的帮助.
Can any please immediately help me to resolve this issue. I shall be very thankful for timely help.
谢谢.
推荐答案
请确保您没有初始化数据库.只需调用一次即可,您可以将其放入DbContext类的静态构造函数中
make sure that you don't have a database initialized. Only have to call it once so you could put it in a static constructor of your DbContext class
Database.SetInitializer<YourDbContext>(null);
这篇关于自创建数据库以来,支持"POSContext"上下文的模型已更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!