我需要使用First
命名类作为 GraphQL 输入类型,所以我创建了FirstInputType
类。
我可以映射Name
属性,FirstInputType
但不能映射MyArray
命名的二维数组。我应该如何映射它?
public class First
{
public string Name {get;set;}
public Second[][] MyArray {get;set;}
}
public class Second
{
public string Prop1 {get; set;}
public int Prop2 {get; set;}
}
public class FirstInputType : InputObjectGraphType<First>
{
public FirstInputType()
{
Field(x => x.Name);
/*
In Runtime: System.ArgumentOutOfRangeException: 'Type '...SecondInputType[][]' is not a graph type. (Parameter 'value')'
*/
Field(x=>x.MyArray, type: typeof(SecondInputType[][]));
}
}
public class SecondInputType : InputObjectGraphType<Second>
{
public SecondInputType()
{
Field(x => x.Prop1);
Field(x => x.Prop2);
}
}
dotnetcore v3.1
GraphQL.Server.Transports.AspNetCore v5.0.2