当前位置:Gxlcms > 数据库问题 > EF Code First(The model backing the '***' context has changed since the database was created.解决方法)(CSDN手动迁移)

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

时间:2021-07-01 10:21:17 帮助过:3人阅读

错误消息:

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手动迁移)

标签:

人气教程排行