try{
context.SaveChanges();
}
catch (DbEntityValidationException ex)
{
var errorMessages = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
var fullErrorMessage = string.Join(", ", errorMessages);
}
原文地址:https://www.cnblogs.com/jasonlai2016/p/10855822.html
时间: 2024-10-11 04:54:10