예제 #1
0
        public FieldType GetFieldType(bool isInput)
        {
            if (_fieldType != null)
            {
                return(_fieldType);
            }

            var name = typeof(TQuery).Name;

            name       = !name.EndsWith("Query") ? name : name.Substring(0, name.Length - "Query".Length);
            _fieldType = new FieldType
            {
                ResolvedType = QueryParametersHelper.GetQueryItemType(this, typeof(TResult), false),
                Name         = name,
                Description  = typeof(TQuery).GetCustomAttribute <DescriptionAttribute>()?.Description,
                Arguments    = QueryParametersHelper.GetArguments(typeof(TQuery), this, true),
                Resolver     = new FuncFieldResolver <TResult>(context => ExecuteQuery(context).GetAwaiter().GetResult()),
            };
            return(_fieldType);
        }
예제 #2
0
 public IGraphType GetQueryItemType(Type modelType, bool isInput)
 {
     return(QueryParametersHelper.GetQueryItemType(this, modelType, isInput));
 }