dbentityvalidationexception专题

显示EF实体对象的详细错误信息 db.Entry(entity).GetValidationResult() 或 catch (DbEntityValidationException ex)

方法一:在快速监视中查看db.Entry(entity).GetValidationResult() public class NewsDal{public static News Add(News entity){using (CmsContext db = new CmsContext()){News news = new News();try{news = db.News