Пример #1
0
        IEnumerable <IValidatedElement> IValidatedType.GetValidatedFields()
        {
            var flyweight = new MetadataValidatedElement(Ruleset);

            foreach (FieldInfo fieldInfo in TargetType.GetFields(BindingFlags.Public | BindingFlags.Instance))
            {
                flyweight.UpdateFlyweight(fieldInfo);
                yield return(flyweight);
            }
        }
Пример #2
0
        IEnumerable <IValidatedElement> IValidatedType.GetValidatedProperties()
        {
            var flyweight = new MetadataValidatedElement(Ruleset);

            foreach (PropertyInfo propertyInfo in TargetType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {
                if (ValidationReflectionHelper.IsValidProperty(propertyInfo))
                {
                    flyweight.UpdateFlyweight(propertyInfo);
                    yield return(flyweight);
                }
            }
        }
Пример #3
0
        IEnumerable <IValidatedElement> IValidatedType.GetValidatedMethods()
        {
            var flyweight = new MetadataValidatedElement(Ruleset);

            foreach (MethodInfo methodInfo in TargetType.GetMethods(BindingFlags.Public | BindingFlags.Instance))
            {
                ParameterInfo[] parameters = methodInfo.GetParameters();

                if (ValidationReflectionHelper.IsValidMethod(methodInfo))
                {
                    flyweight.UpdateFlyweight(methodInfo);
                    yield return(flyweight);
                }
            }
        }