自创建数据库以来,支持"POSContext"上下文的模型已更改 [英] The model backing the 'POSContext' context has changed since the database was created

查看:61
本文介绍了自创建数据库以来,支持"POSContext"上下文的模型已更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用数据库优先方法在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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆