public Validator CreateValidator(IValidatedType validatedType)
        {
            List<Validator> validators = new List<Validator>();

            CollectValidatorsForType(validatedType, validators);
            CollectValidatorsForProperties(validatedType.GetValidatedProperties(), validators);
            CollectValidatorsForFields(validatedType.GetValidatedFields(), validators);
            CollectValidatorsForMethods(validatedType.GetValidatedMethods(), validators);
            CollectValidatorsForSelfValidationMethods(validatedType.GetSelfValidationMethods(), validators);

            return new AndCompositeValidator(validators.ToArray());
        }
Example #2
0
        public Validator CreateValidator(IValidatedType validatedType)
        {
            List <Validator> validators = new List <Validator>();

            CollectValidatorsForType(validatedType, validators);
            CollectValidatorsForProperties(validatedType.GetValidatedProperties(), validators, validatedType.TargetType);
            CollectValidatorsForFields(validatedType.GetValidatedFields(), validators, validatedType.TargetType);
            CollectValidatorsForMethods(validatedType.GetValidatedMethods(), validators, validatedType.TargetType);
            CollectValidatorsForSelfValidationMethods(validatedType.GetSelfValidationMethods(), validators);

            return(new AndCompositeValidator(validators.ToArray()));
        }
Example #3
0
 public Validator CreateValidator(IValidatedType validatedType)
 {
     List<Validator> validators = new List<Validator>();
     this.CollectValidatorsForType(validatedType, validators);
     this.CollectValidatorsForProperties(validatedType.GetValidatedProperties(), validators, validatedType.TargetType);
     this.CollectValidatorsForFields(validatedType.GetValidatedFields(), validators, validatedType.TargetType);
     this.CollectValidatorsForMethods(validatedType.GetValidatedMethods(), validators, validatedType.TargetType);
     this.CollectValidatorsForSelfValidationMethods(validatedType.GetSelfValidationMethods(), validators);
     if (validators.Count == 1)
     {
         return validators[0];
     }
     return new AndCompositeValidator(validators.ToArray());
 }
Example #4
0
        public Validator CreateValidator(IValidatedType validatedType)
        {
            List <Validator> list = new List <Validator>();

            this.CollectValidatorsForType(validatedType, list);
            this.CollectValidatorsForProperties(validatedType.GetValidatedProperties(), list, validatedType.TargetType);
            this.CollectValidatorsForFields(validatedType.GetValidatedFields(), list, validatedType.TargetType);
            this.CollectValidatorsForMethods(validatedType.GetValidatedMethods(), list, validatedType.TargetType);
            this.CollectValidatorsForSelfValidationMethods(validatedType.GetSelfValidationMethods(), list);
            if (list.Count == 1)
            {
                return(list[0]);
            }
            return(new AndCompositeValidator(list.ToArray()));
        }
        public Validator CreateValidator(IValidatedType validatedType)
        {
            var validators = new List <Validator>();

            CollectValidatorsForType(validatedType, validators);
            CollectValidatorsForProperties(validatedType.GetValidatedProperties(), validators);
            CollectValidatorsForFields(validatedType.GetValidatedFields(), validators);
            CollectValidatorsForMethods(validatedType.GetValidatedMethods(), validators);
            CollectValidatorsForSelfValidationMethods(validatedType.GetSelfValidationMethods(), validators);

            if (validators.Count == 1)
            {
                return(validators[0]);
            }
            return(new AndCompositeValidator(validators.ToArray()));
        }