一.在Models 新建两个数据库类 这个是数据库需要生成的类基础(塑造外观) public class User { [Key] public string ID { get; set; } [MaxLength()] public string Name { get; set; } public int Age { get; set; } [MaxLength()] public string Phone { get; set; } public string DepartmentID {…
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.在Glo…