Esempio n. 1
0
        public static Task <T> InvokeAsync <T>(
            this IGraphQLQueryResolver resolver,
            IResolveFieldContext <object> context,
            string methodName)
        {
            var type   = resolver.GetType();
            var method = type.GetMethod(methodName);
            var values = new List <object>();

            foreach (var p in method.GetParameters())
            {
                values.Add(context.GetArgument(p.ParameterType, p.Name));
            }

            return((Task <T>)method.Invoke(resolver, values.ToArray()));
        }
Esempio n. 2
0
        public static QueryArguments GetQueryArguments(
            this IGraphQLQueryResolver resolver,
            string methodName)
        {
            var type      = resolver.GetType();
            var method    = type.GetMethod(methodName);
            var arguments = new QueryArguments();

            foreach (var p in method.GetParameters())
            {
                arguments.Add(new QueryArgument(GetGraphQLType(p.ParameterType))
                {
                    Name = p.Name
                });
            }

            return(arguments);
        }