/// <summary> /// Initializes a new instance of the <see cref="ConfigurationValidatedElement"/> class for a method. /// </summary> /// <param name="validatedMethodReference">The method reference configuration object.</param> /// <param name="methodInfo">The method.</param> public ConfigurationValidatedElement(ValidatedMethodReference validatedMethodReference, MethodInfo methodInfo) { UpdateFlyweight(validatedMethodReference, methodInfo); }
/// <summary> /// Updates the flyweight for a method. /// </summary> /// <param name="validatedMethodReference">The method reference configuration object.</param> /// <param name="methodInfo">The method.</param> public void UpdateFlyweight(ValidatedMethodReference validatedMethodReference, MethodInfo methodInfo) { if (methodInfo == null) throw new ArgumentNullException("methodInfo"); UpdateFlyweight(validatedMethodReference, methodInfo, methodInfo.ReturnType); }
/// <summary> /// This member supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// </summary> public Validator CreateValidatorForMethod(Type type, ValidatedMethodReference methodReference) { if (methodReference == null) throw new ArgumentNullException("methodReference"); if (methodReference.Validators.Count == 0) return null; MethodInfo methodInfo = ValidationReflectionHelper.GetMethod(type, methodReference.Name, false); if (methodInfo == null) return null; ConfigurationValidatedElement validatedElement = new ConfigurationValidatedElement(methodReference, methodInfo); return CreateValidatorForValidatedElement(validatedElement, this.GetCompositeValidatorBuilderForMethod); }