IEnumerable <IValidatedElement> IValidatedType.GetValidatedMethods() { ConfigurationValidatedElement flyweight = new ConfigurationValidatedElement(); foreach (ValidatedMethodReference validatedMemberReference in this.ruleData.Methods) { if (validatedMemberReference.Validators.Count == 0) { continue; } MethodInfo methodInfo = ValidationReflectionHelper.GetMethod(this.targetType, validatedMemberReference.Name, false); if (methodInfo == null) { continue; } flyweight.UpdateFlyweight(validatedMemberReference, methodInfo); yield return(flyweight); } }
/// <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)); }