예제 #1
0
        internal static Type?GetNamedType(Type type)
        {
            if (type is null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (BaseTypes.IsNamedType(type))
            {
                return(type);
            }

            if (type.IsGenericType)
            {
                Type definition = type.GetGenericTypeDefinition();
                if (typeof(ListType <>) == definition ||
                    typeof(NonNullType <>) == definition ||
                    typeof(NativeType <>) == definition)
                {
                    return(GetNamedType(type.GetGenericArguments()[0]));
                }
            }

            return(null);
        }
예제 #2
0
        internal static bool IsSchemaType(Type type)
        {
            if (BaseTypes.IsNamedType(type))
            {
                return(true);
            }

            if (type.IsGenericType)
            {
                Type definition = type.GetGenericTypeDefinition();
                if (typeof(ListType <>) == definition ||
                    typeof(NonNullType <>) == definition ||
                    typeof(NativeType <>) == definition)
                {
                    return(IsSchemaType(type.GetGenericArguments()[0]));
                }
            }

            return(false);
        }