I have a problem with GraphQL.Net library. I've used "GraphQL" Version="3.2.0", "GraphQL.Server.Ui.Playground" Version="4.4.0" and TargetFramework = netcoreapp3.0 I'm trying to see how it works and I created a simple class:
public class Temp
{
public int MyProperty { get; set; }
}
public class TempType : ObjectGraphType<Temp>
{
public TempType()
{
Name = "TEmp";
Field(t => t.MyProperty).Description("temp");
}
}
public class SolDataQuery : ObjectGraphType
{
public SolDataQuery(ISolDataFill sdFill)
{
Name = "Query";
Field<IntGraphType>("soldata", resolve: context => 5);
Field<TempType>("wheater", resolve: context => new Temp { MyProperty = 2 });
}
}
After start in playground I requested a query : { wheather {myProperty}} and I saw: "message": "Error executing document.", "code": "INVALID_OPERATION". If I changed my code and comment line "Field("wheater", resolve: context => new Temp { MyProperty = 2 });" I requested a query {soldata} and saw the correct result "5". Could anybody tell me, please, where is my errors?