Code First 经常出现 Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has
Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions.
出现这样的错误就需要删除数据库在运行代码即可重新生成数据库。
通常的原因是因为你的数据库中已经存在了部分数据,但是并没y响应的描述数据所造成,注意一下,在数据库中增加了一个名为 EdmMetadata 的表。你可以直接删除原来的数据库,重新运行即可。