【发布时间】:2021-11-25 19:20:32
【问题描述】:
我使用的是 HotChocolate 12.0.1。我有以下类型定义:
public class MyType : ObjectType<My>
{
protected override void Configure(IObjectTypeDescriptor<My> descriptor)
{
descriptor.Field(p => p.Name)
.ResolveWith<TestResolver>(r => r.Get(default))
.Type<IdType>();
descriptor.Field(p => p.Logo)
.Type<StringType>();
}
private class TestResolver
{
public string Get(My my)
{
return my.Logo;
}
}
}
我希望在 TestResolver Get(My my) 中注入我的对象,因为它填充了 Logo 值,正如我在示例中看到的那样: https://github.com/ChilliCream/graphql-workshop/blob/master/docs/3-understanding-dataLoader.md
但由于某种原因,我从 HotChocolate 参数查找中得到了:
There was no argument with the name `my` found on the field `name`.
我的查询:
query {
my(someId: 123) {
name
logo
}
}
启动:
services.AddGraphQLServer()
.AddQueryType<QueryType>()
.AddType<MyType>()
问题可能出在哪里?
【问题讨论】:
-
我在this tutorial也遇到了这个问题:/我试过调试,好像没有使用解析器
标签: asp.net-core graphql hotchocolate