码迷,mamicode.com
首页 > 数据库 > 详细

EF Code First(The model backing the '***' context has changed since the database was created.解决方法)(CSDN手动迁移)

时间:2015-06-30 20:07:03      阅读:992      评论:0      收藏:0      [点我收藏+]

标签:

错误消息:

The model backing the ‘***‘ context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).

错误原因:

(1)数据模型发生改变,而没有更新到数据库导致此问题。

事实上我遇到的情况不是原因(1),而是(2)造成的

(2)更新到数据库 用的EF 6.1.0 ,而数据访问层用的是EF 6.0.2

解决方法:

(1)用Code First  更新数据库,命令如下:

Add-Migration
Update-Database -Verbose

(2)数据访问层换成EF 6.1.0 ,问题解决

EF Code First(The model backing the '***' context has changed since the database was created.解决方法)(CSDN手动迁移)

标签:

原文地址:http://www.cnblogs.com/hetring/p/4611231.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!