我有一个 CustomerDetails 类:
public record CustomerDetails{
public string? Code { get; init; }
public string? Name { get; init; }
public string? Notes { get; init; }
}
Run Code Online (Sandbox Code Playgroud)
在 GraphQL 方面,我有以下内容:
在查询方面:
public class CustomerDetailsGraphType : AutoRegisteringObjectGraphType<CustomerDetails> { }
Run Code Online (Sandbox Code Playgroud)
在突变方面:
public class CustomerDetailsInputGraphType : AutoRegisteringInputObjectGraphType<CustomerDetails> {}
Run Code Online (Sandbox Code Playgroud)
当我运行此命令并尝试在 Altair 中查看架构时,它给出了以下类型的错误:
"message": "GraphQL.Execution.UnhandledError: Error executing document.\r\n ---> System.InvalidOperationException: Unable to register GraphType 'MyProject.Customers.Mutations.ContactDetailsInputGraphType' with the name 'ContactDetails';\nthe name 'ContactDetails' is already registered to 'MyProject.Customers.Query.ContactDetailsGraphType'.\r\n..."
Run Code Online (Sandbox Code Playgroud)
我不明白为什么会这样?