When the app throws an entity exception, it would give a generic details about the error. By using following exception handling block , we would be able to find particular exception in-detail.
catch (DbEntityValidationException Ex) { foreach (var errors in Ex.EntityValidationErrors) { foreach (var validationError in errors.ValidationErrors) { Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } }
No comments:
Post a Comment