internal static Validator GetPropertyValidator(Type type, PropertyInfo propertyInfo, string ruleset, ValidationSpecificationSource validationSpecificationSource, MemberAccessValidatorBuilderFactory memberAccessValidatorBuilderFactory) { if (type == null) { throw new InvalidOperationException(Resources.ExceptionTypeNotFound); } if (propertyInfo == null) { throw new InvalidOperationException(Resources.ExceptionPropertyNotFound); } if (!propertyInfo.CanRead) { throw new InvalidOperationException(Resources.ExceptionPropertyNotReadable); } switch (validationSpecificationSource) { case ValidationSpecificationSource.Attributes: return(PropertyValidationFactory.GetPropertyValidatorFromAttributes(type, propertyInfo, ruleset, memberAccessValidatorBuilderFactory)); case ValidationSpecificationSource.Both: return(PropertyValidationFactory.GetPropertyValidator(type, propertyInfo, ruleset, memberAccessValidatorBuilderFactory)); } return(null); }
internal static Validator GetPropertyValidator(Type type, PropertyInfo propertyInfo, string ruleset, ValidationSpecificationSource validationSpecificationSource, MemberValueAccessBuilder memberValueAccessBuilder) { return(PropertyValidationFactory.GetPropertyValidator(type, propertyInfo, ruleset, validationSpecificationSource, new MemberAccessValidatorBuilderFactory(memberValueAccessBuilder))); }