关于EF Codefirst使用非sqlce版本

遇到报错如下:

Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions.


建议:

1.删除原有数据库

2.在Application_Start里面应该为以下代码

if (!Database.Exists("connString"))
            {
                Database.SetInitializer<SchoolContext>(new SchoolInitializer());
            }
posted @ 2012-10-27 16:15  kenchen20050821  阅读(166)  评论(0编辑  收藏  举报