using System.Collections.Generic;
using CK.Tutorial.GraphQlApi.Business;
using CK.Tutorial.GraphQlApi.Model.Request;
using CK.Tutorial.GraphQlApi.Web.Extensions;
using CK.Tutorial.GraphQlApi.Web.Types;
namespace CK.Tutorial.GraphQlApi.Web.Query
public class TutorialQuery : ObjectGraphType
public TutorialQuery(ICompanyService companyService)
arguments: new QueryArguments(new List<QueryArgument>
new QueryArgument<IntGraphType>
new QueryArgument<StringGraphType>
new QueryArgument<BooleanGraphType>
resolve: delegate (ResolveFieldContext<object> context)
var columns = context.GetMainSelectedFields();
var companyId = context.GetArgument<int?>("companyId");
var companyName = context.GetArgument<string>("companyName");
var isActive = context.GetArgument<bool?>("isActive");
var request = new SearchCompany
return companyService.GetCompany(request);
Field<ListGraphType<CompanyGraphType>>(
arguments: new QueryArguments(new List<QueryArgument>
new QueryArgument<ListGraphType<IntGraphType>>
new QueryArgument<ListGraphType<StringGraphType>>
new QueryArgument<BooleanGraphType>
new QueryArgument<IntGraphType>
new QueryArgument<IntGraphType>
resolve: delegate (ResolveFieldContext<object> context)
var columns = context.GetMainSelectedFields();
var companyIds = context.GetArgument<int?[]>("companyIds");
var companyNames = context.GetArgument<string[]>("companyNames");
var isActive = context.GetArgument<bool?>("isActive");
var page = context.GetArgument<int?>("page");
var pageSize = context.GetArgument<int?>("pageSize");
var request = new SearchCompanies()
return companyService.GetCompanies(request);