实体框架6.1.1禁止模式的兼容性检查 [英] Entity Framework 6.1.1 disable model compatibility checking
问题描述
类型的未处理的异常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屋!