MVC3.0 Error(Metadata)

Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that Include Metadata Convention has been added to the DbModelBuilder conventions.

碰到此错误是由于使用了Code First来生成数据库,生成数据库之后修改了模型。只需要在Global.asax.cs的Application_Start()方法中将Database.SetInitializer<DbContext>(new DatabaseInitializer());改为Database.SetInitializer<DbContext>(null);即可。

posted @ 2013-06-21 10:13  曉軒  阅读(209)  评论(0编辑  收藏  举报