/// <summary>
/// Gets the validation errors for a specified property or for the entire object.
/// </summary>
/// <param name="propertyName">The name of the property to retrieve validation errors for, or null or <see cref="F:System.String.Empty"/> to retrieve errors for the entire object.</param>
/// <returns>
/// The validation errors for the property or object.
/// </returns>
IEnumerable INotifyDataErrorInfo.GetErrors(string propertyName)
{
if (HideValidationResults)
{
yield return(null);
}
if (string.IsNullOrEmpty(propertyName))
{
lock (ValidationContext)
{
foreach (var error in ValidationContext.GetBusinessRuleErrors())
{
yield return(error.Message);
}
}
}
else
{
lock (ValidationContext)
{
foreach (var error in ValidationContext.GetFieldErrors(propertyName))
{
yield return(error.Message);
}
}
}
}