public void Validate(MemberInfo memberInfo, object value) { if (_configurationValidatorBase == null) { return; } Type memberType = ChoType.GetMemberType(memberInfo); if (_configurationValidatorBase.CanValidate(memberType)) { _configurationValidatorBase.Validate(value); } }
public void Validate(MemberInfo memberInfo, object value) { if (value == null || _validator.CanValidate(value.GetType())) { _validator.Validate(value); } }
protected override void ValidateCore(object instance, string value, IList <ValidationResult> results) { var property = instance as ElementProperty; if (property == null) { return; } if (validatorInstance.CanValidate(property.PropertyType)) { try { validatorInstance.Validate(value); } catch (Exception ex) { results.Add(new PropertyValidationResult(property, ex.Message)); } } }
public override void Validate(object value, bool silent) { if (ValidatorInstance is ChoValidatorBase) { ChoValidatorBase validatorInstance = ValidatorInstance as ChoValidatorBase; if (validatorInstance != null && !silent && (value != null && validatorInstance.CanValidate(value.GetType()))) { validatorInstance.Validate(value); } } else if (ValidatorInstance is ConfigurationValidatorBase) { ConfigurationValidatorBase validatorInstance = ValidatorInstance as ConfigurationValidatorBase; if (validatorInstance != null && !silent && (value != null && validatorInstance.CanValidate(value.GetType()))) { validatorInstance.Validate(value); } } }