首页 > Web开发 > 详细

解决MVC EF Code First错误:Model compatibility cannot be checked because the EdmMetadata type was not included in the model.

时间:2014-07-16 13:39:39      阅读:390      评论:0      收藏:0      [点我收藏+]
Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions.

分析:

碰到此错误是由于使用了EF Code First来生成数据库,生成数据库之后又修改了模型。 

两种解决方式:

1.在Global.asax.cs的Application_Start()方法中将Database.SetInitializer<xxxDbContext>(new DatabaseInitializer());改为Database.SetInitializer<xxxDbContext>(null)(如果有初始化数据库的数据方法的前提下)

2.删除数据库(治标不治本)。

bubuko.com,布布扣
USE MASTER
GO
DROP DATABASE [DBNAME]
View Code

解决MVC EF Code First错误:Model compatibility cannot be checked because the EdmMetadata type was not included in the model.,布布扣,bubuko.com

解决MVC EF Code First错误:Model compatibility cannot be checked because the EdmMetadata type was not included in the model.

原文:http://www.cnblogs.com/xilipu31/p/3848443.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!