Пример #1
0
        public GraphQLTypeDescription GetTypeDescription(Type targetType)
        {
            if (!targetType.IsGenericType)
            {
                throw new InvalidOperationException(); // todo message
            }

            var enumType = targetType.GetGenericArguments()[0];

            return(GraphQLTypeDescription.Named(enumType.Name));
        }
        public GraphQLTypeDescription GetTypeDescription(Type targetType)
        {
            Check.IsNotNull(targetType, nameof(targetType));

            if (!targetType.IsGenericType)
            {
                throw new InvalidOperationException(); // todo message
            }

            var elementType        = targetType.GetGenericArguments()[0];
            var elementTypeAdapter = GraphQLTypeHelper.CreateTypeAdapter(elementType);

            return(GraphQLTypeDescription.NotNull(elementTypeAdapter.GetTypeDescription(elementType)));
        }
Пример #3
0
 public GraphQLTypeDescription GetTypeDescription(Type targetType)
 {
     return(GraphQLTypeDescription.Named("Int"));
 }
        public GraphQLTypeDescription GetTypeDescription(Type targetType)
        {
            var displayAttribute = targetType.GetCustomAttribute <GraphQLObjectAttribute>();

            return(GraphQLTypeDescription.Named(displayAttribute?.Name ?? targetType.Name));
        }