catch (DbEntityValidationException ex)
{
foreach (var eve in ex.EntityValidationErrors)
{
responseBase.Message = string.Format(@"Entity of type \{0}\ in state \{1}\ has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State);
foreach (var ve in eve.ValidationErrors)
{
responseBase.Message= string.Format(@"- Property: \{0}\, Error: \{1}\", ve.PropertyName, ve.ErrorMessage);
}
}
throw;
}
No comments:
Post a Comment