Пример #1
0
        internal static List <CandidateValidation> AllPossible(ValidationInfo val, TargetSet targetSet)
        {
            List <CandidateValidation> set = null;

            foreach (var fieldInfo in val.Fields)
            {
                var fieldTargets = targetSet.GetFields(fieldInfo.Name).Select(f => new ValidationFieldSource(f.Target, fieldInfo, f));
                if (set == null)
                {
                    set = fieldTargets.Select(f => new CandidateValidation(val, f)).ToList();
                }
                else
                {
                    set = fieldTargets.SelectMany(t => set.Select(s => new CandidateValidation(t, s))).ToList();
                }
            }

            return(set);
        }
Пример #2
0
        internal static IEnumerable <RequiredValidation> Select(IValidationCatalog catalog, TargetSet targetSet)
        {
            var allPossible = catalog.Validations().SelectMany(v => CandidateSelector.AllPossible(v, targetSet)).ToList();

            return(ValidationRuleChecker.Filter(allPossible));
        }