码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2014-07-16 13:44:15      阅读:255      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   使用   strong   

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.

标签:style   blog   http   color   使用   strong   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!