我对实体进行了一些更改,并在 packageManager 控制台中成功执行了“update-database -verbose”,我可以看到 Azure 数据库中反射(reflect)的更改。
然后我部署到 Azure 云,并从 Azure 云收到错误消息
"The model backing the 'myDBContext' context has changed since the database was created. Consider using Code First Migrations to update the database"
我尝试设置 Configuration.AutoDetectChangesEnabled = false 并重新部署
但我仍然遇到同样的错误。
请帮忙..
最佳答案
我通过添加解决了这个问题
Database.SetInitializer<MyContext>(null);
到 Global.asax.cs 内的 Application_Start()
关于entity-framework - 自创建数据库以来,支持 'myDBContext' 上下文的模型已发生更改。考虑使用 Code First 迁移来更新数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20009668/