コード例 #1
0
        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);
        }
コード例 #2
0
        private IEnumerable <PropertyDescriptor> GetValidatableProperties()
        {
            var properties = TypeDescriptor.GetProperties(ValidatableObject.GetType());

            return(properties.Cast <PropertyDescriptor>().Where(i => i.IsValidatable()).ToArray());
        }
コード例 #3
0
        private IEnumerable <PropertyDescriptor> GetNonValidatableProperties()
        {
            var properties = TypeDescriptor.GetProperties(ValidatableObject.GetType()).Cast <PropertyDescriptor>();

            return(properties.ToArray());
        }
コード例 #4
0
        private PropertyDescriptor GetProperty(string name)
        {
            var properties = TypeDescriptor.GetProperties(ValidatableObject.GetType());

            return(properties[name]);
        }