GetResult() private method

private GetResult ( ) : ValidationResult
return ValidationResult
示例#1
0
        /// <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>
        public IEnumerable GetErrors(string propertyName)
        {
            var validationResult = Validator.GetResult(propertyName);

            // Return all the errors as a single string because most UI implementations display only first error
            return(validationResult.IsValid ? Enumerable.Empty <string>() : new[] { validationResult.ToString() });
        }
示例#2
0
 /// <summary>
 /// Gets the error message for the property with the given name.
 /// </summary>
 /// <returns>The error message for the property. The default is an empty string ("").</returns>
 public string this[string columnName]
 {
     get { return(Validation.GetResult(columnName).ToString()); }
 }