public virtual ValidateErrors GetAllErrors(string propertyName) { var errors = new ValidateErrors(ValidatableObject.GetType().FullName); var items = GetErrors(propertyName); if (items.Count == 0) { return(errors); } var errorsList = new ValidateErrorsList(); foreach (var err in items) { errorsList.AddRange(err.ToArray()); } errors.Set(propertyName, errorsList); return(errors); }
private IEnumerable <PropertyDescriptor> GetValidatableProperties() { var properties = TypeDescriptor.GetProperties(ValidatableObject.GetType()); return(properties.Cast <PropertyDescriptor>().Where(i => i.IsValidatable()).ToArray()); }
private IEnumerable <PropertyDescriptor> GetNonValidatableProperties() { var properties = TypeDescriptor.GetProperties(ValidatableObject.GetType()).Cast <PropertyDescriptor>(); return(properties.ToArray()); }
private PropertyDescriptor GetProperty(string name) { var properties = TypeDescriptor.GetProperties(ValidatableObject.GetType()); return(properties[name]); }