gpt4 book ai didi

c# - GraphQL HotChocolate 添加 PaginationAmountType 将我的 int 转换为 PaginationAmmount

转载 作者:行者123 更新时间:2023-12-04 08:13:31 24 4
gpt4 key购买 nike

当我添加 PaginationAmmountType 来设置每页的最大记录时,我的所有模型 int 变量都会变成 PaginatioAmount

services.AddGraphQL(SchemaBuilder.New()
.AddType(new PaginationAmountType(100))
.AddQueryType<Query>()
.AddMutationType<Mutation>()
.AddAuthorizeDirectiveType()
);
这就是没有 PaginationAmountType 的样子

然后这就是我添加 PaginationAmountType 时的变化
enter image description here
我该如何解决这个问题,或者我到底做错了什么,我需要指定每页的最大记录数,但是这种方法会弄乱我的模型。

最佳答案

我认为问题在于 PaginationAmount也是基于IntType .架构发现 PaginationType并将其绑定(bind)到 int类型
你可以试试这个:

services.AddGraphQL(SchemaBuilder.New()
.AddQueryType<Query>()
.AddMutationType<Mutation>()
.AddAuthorizeDirectiveType()
.AddType(new IntType())
.AddType(new PaginationAmountType(100))
);
顺便提一句。我们发布了第 11 版。它带来了很多新功能和改进。我们还完全删除了 PaginationAmountType。
查看迁移指南:
https://chillicream.com/docs/hotchocolate/api-reference/migrate-from-10-to-11/

关于c# - GraphQL HotChocolate 添加 PaginationAmountType 将我的 int 转换为 PaginationAmmount,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65827480/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com