private PropertyValidator GetTypeValidator(ICustomTypeDescriptor typeDescriptor)
        {
            var classAttributes = typeDescriptor.GetAttributes().OfType <ValidationAttribute>();

            var classValidator =
                new PropertyValidator
            {
                AttributeAdaptors = GetAttributeAdaptors(classAttributes)
            };

            return(classValidator);
        }
        private IEnumerable <PropertyValidator> GetPropertyValidators(ICustomTypeDescriptor typeDescriptor)
        {
            var propertyDescriptors = typeDescriptor.GetProperties();

            foreach (PropertyDescriptor descriptor in propertyDescriptors)
            {
                var attributes = descriptor.Attributes.OfType <ValidationAttribute>();

                var validator =
                    new PropertyValidator
                {
                    AttributeAdaptors = GetAttributeAdaptors(attributes),
                    Descriptor        = descriptor
                };

                yield return(validator);
            }
        }