/// <summary> /// Updates the flyweight for a property. /// </summary> /// <param name="validatedPropertyReference">The property reference configuration object.</param> /// <param name="propertyInfo">The property.</param> public void UpdateFlyweight(ValidatedPropertyReference validatedPropertyReference, PropertyInfo propertyInfo) { if (propertyInfo == null) throw new ArgumentNullException("propertyInfo"); UpdateFlyweight(validatedPropertyReference, propertyInfo, propertyInfo.PropertyType); }
/// <summary> /// Initializes a new instance of the <see cref="ConfigurationValidatedElement"/> class for a property. /// </summary> /// <param name="validatedPropertyReference">The property reference configuration object.</param> /// <param name="propertyInfo">The property.</param> public ConfigurationValidatedElement(ValidatedPropertyReference validatedPropertyReference, PropertyInfo propertyInfo) { UpdateFlyweight(validatedPropertyReference, propertyInfo); }
/// <summary> /// /// </summary> /// <param name="type"></param> /// <param name="propertyReference"></param> /// <returns></returns> public Validator CreateValidatorForProperty(Type type, ValidatedPropertyReference propertyReference) { if (propertyReference == null) throw new ArgumentNullException("propertyReference"); if (propertyReference.Validators.Count == 0) return null; PropertyInfo propertyInfo = ValidationReflectionHelper.GetProperty(type, propertyReference.Name, false); if (propertyInfo == null) return null; ConfigurationValidatedElement validatedElement = new ConfigurationValidatedElement(propertyReference, propertyInfo); return CreateValidatorForValidatedElement(validatedElement, this.GetCompositeValidatorBuilderForProperty); }