Validation failed for one or more entities. See ‘EntityValidationErrors

try{
  context.SaveChanges();
}
catch (DbEntityValidationException ex)
{
  var errorMessages = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
  var fullErrorMessage = string.Join(", ", errorMessages);
}

posted @ 2019-05-13 11:47  jasonlai2016  阅读(169)  评论(0编辑  收藏  举报