Example #1
0
 Validator IValidatorDescriptor.CreateValidator(Type targetType, Type ownerType, MemberValueAccessBuilder memberValueAccessBuilder)
 {
     Validator validator = this.DoCreateValidator(targetType, ownerType, memberValueAccessBuilder);
     validator.Tag = base.Tag;
     validator.MessageTemplate = base.GetMessageTemplate();
     return validator;
 }
 protected override Validator DoCreateValidator(Type targetType, Type ownerType, MemberValueAccessBuilder memberValueAccessBuilder)
 {
     PropertyInfo propertyInfo = ValidationReflectionHelper.GetProperty(ownerType, this.propertyToCompare, false);
     if (propertyInfo == null)
     {
         throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.ExceptionPropertyToCompareNotFound, new object[] { this.propertyToCompare, ownerType.FullName }));
     }
     return new PropertyComparisonValidator(memberValueAccessBuilder.GetPropertyValueAccess(propertyInfo), this.comparisonOperator, base.Negated);
 }
Example #3
0
 internal static Validator GetPropertyValidator(Type type, PropertyInfo propertyInfo, string ruleset, ValidationSpecificationSource validationSpecificationSource, MemberValueAccessBuilder memberValueAccessBuilder)
 {
     return(PropertyValidationFactory.GetPropertyValidator(type, propertyInfo, ruleset, validationSpecificationSource, new MemberAccessValidatorBuilderFactory(memberValueAccessBuilder)));
 }
 public MemberAccessValidatorBuilderFactory(MemberValueAccessBuilder valueAccessBuilder)
 {
     this.valueAccessBuilder = valueAccessBuilder;
 }
Example #5
0
 protected virtual Validator DoCreateValidator(Type targetType, Type ownerType, MemberValueAccessBuilder memberValueAccessBuilder)
 {
     return this.DoCreateValidator(targetType);
 }