实体框架6.1.1禁止模式的兼容性检查 [英] Entity Framework 6.1.1 disable model compatibility checking

查看:95
本文介绍了实体框架6.1.1禁止模式的兼容性检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




类型的未处理的异常System.InvalidOperationException:

我更新EF到6.1.1版本后,运行到以下错误发生在EntityFramework.dll




附加信息:该模型支持的 TvstContext 环境已经改变,因为该数据库已创建。考虑使用的Code First迁移来更新数据库( http://go.microsoft.com/fwlink/ ?LINKID = 238269



在这个问题的描述,我们可以在过去解决这个问题:
Where是modelBuilder.IncludeMetadataInDatabase在EF CTP5?



不过,我似乎无法摆脱的错误。


解决方案

这应该工作,把它放在某处派生的DbContext的构造器:

  Database.SetInitializer< MyContext>(NULL); 


I am running into the following error after updating EF to version 6.1.1:

An unhandled exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll

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

We could fix this in the past as described in this question: Where is modelBuilder.IncludeMetadataInDatabase in EF CTP5?

However, I can't seem to get rid of the error.

解决方案

This should work, put it somewhere in the constructor of your derived DbContext:

Database.SetInitializer<MyContext>(null);

这篇关于实体框架6.1.1禁止模式的兼容性检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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