asp.net-mvc-3 - 自数据库创建以来上下文已更改

标签 asp.net-mvc-3

当我运行 MVC3 应用程序时,出现此错误:

The model backing the 'MoviesDB' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer instance. For example, the DropCreateDatabaseIfModelChanges strategy will automatically delete and recreate the database, and optionally seed it with new data.

我正在使用 EF 4.1。请提出解决方案。

最佳答案

看起来您在电影模型或数据库中添加了一个条目。确保架构匹配并删除 EdmMetadata 表。

关于asp.net-mvc-3 - 自数据库创建以来上下文已更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5754813/

相关文章:

c# - 在自定义属性中查找 mvc3 操作方法参数

ASP.NET MVC3 : Request. IsAuthenticated 总是 "true"来自客户端的 $Ajax 请求

asp.net - Jquery.获取ashx页面

mysql - 导入 csv 和 xls 以批量上传用户以在网站中注册

asp.net-mvc-3 - ASP.NET MVC 3-如何处理Global.asax中的错误?

c# - View 模型验证与领域模型验证

c# - 如何处理在 c# mvc.net 应用程序 Controller 中使用 PhoneGap 上传的音频文件?

asp.net-mvc - ASP.NET MVC - ICollection<T> 映射到 Enum 的 EditorTemplate 问题

asp.net - 如何在mvc3中对来自@Html.LabelFor()的内容进行本地化

asp.net-mvc - HTML 表单上 ASP.NET MVC 中的 PUT 或 DELETE 动词