.net core 如何在Graphql.NET查询中选择items子列表?
查询“customer”返回一个id==传递参数的项.net core 如何在Graphql.NET查询中选择items子列表?,.net-core,graphql,.net Core,Graphql,查询“customer”返回一个id==传递参数的项 {customer(id: 3){id,firstName,lastName,email}} 如何创建查询“customer4”,选择通过参数传递的列表中id所在的客户子列表? 例如,电话 {customer4(id: [3,5]){id,firstName,lastName,email}} var graphList = new QueryArguments(new QueryArgument<NonNullGraphT
{customer(id: 3){id,firstName,lastName,email}}
如何创建查询“customer4”,选择通过参数传递的列表中id所在的客户子列表?
例如,电话
{customer4(id: [3,5]){id,firstName,lastName,email}}
var graphList = new QueryArguments(new QueryArgument<NonNullGraphType<ListGraphType<IntGraphType>>> { Name = "id", Description = "Customer Id" });
var graphList2 = new QueryArguments(new QueryArgument<NonNullGraphType<IntGraphType>> { Name = "id", Description = "Customer Id" });
Field<CustomerGraphType>("customer", "Returns a Single Customer",
graphList2,
context => _appContext.Customers.Single(x => x.Id == context.Arguments["id"].GetPropertyValue<int>()));
Field<ListGraphType<CustomerGraphType>>("customer4", "Returns a Customers Sub-list",
graphList2,
context => _appContext.Customers.Any(x => x.Id == context.Arguments["id"].GetPropertyValue<int>()));
{customer4(id:[3,5]){id,firstName,lastName,email}
var graphList=newqueryarguments(newqueryarguments{Name=“id”,Description=“Customer id”});
var graphList2=新查询项(新查询项{Name=“id”,Description=“Customer id”});
字段(“客户”,“返回单个客户”,
笔划师2,
context=>\u appContext.Customers.Single(x=>x.Id==context.Arguments[“Id”].GetPropertyValue());
字段(“customer4”,“返回客户子列表”,
笔划师2,
context=>_appContext.Customers.Any(x=>x.Id==context.Arguments[“Id”].GetPropertyValue());