Пример #1
0
        private static TypeErrorsBuilder VerifyEnumerableRecursively(
            TypeErrorsBuilder typeErrors,
            Type type,
            MemberSettings settings,
            MemberPath memberPath,
            Func <MemberSettings, MemberPath, TypeErrors> getErrorsRecursively)
        {
            if (typeof(IEnumerable).IsAssignableFrom(type))
            {
                memberPath = memberPath == null
                                 ? new MemberPath(type)
                                 : memberPath.WithCollectionItem(type);

                var recursiveErrors = getErrorsRecursively(settings, memberPath);
                if (recursiveErrors == null)
                {
                    return(typeErrors);
                }

                var collectionErrors = new CollectionErrors(memberPath, recursiveErrors);
                typeErrors = typeErrors.CreateIfNull(type)
                             .Add(collectionErrors);
            }

            return(typeErrors);
        }
Пример #2
0
        private static TypeErrorsBuilder VerifyEnumerableRecursively(
            TypeErrorsBuilder typeErrors,
            Type type,
            MemberSettings settings,
            MemberPath memberPath,
            Func<MemberSettings, MemberPath, TypeErrors> getErrorsRecursively)
        {
            if (typeof(IEnumerable).IsAssignableFrom(type))
            {
                memberPath = memberPath == null
                                 ? new MemberPath(type)
                                 : memberPath.WithCollectionItem(type);

                var recursiveErrors = getErrorsRecursively(settings, memberPath);
                if (recursiveErrors == null)
                {
                    return typeErrors;
                }

                var collectionErrors = new CollectionErrors(memberPath, recursiveErrors);
                typeErrors = typeErrors.CreateIfNull(type)
                                       .Add(collectionErrors);
            }

            return typeErrors;
        }