2

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

services.AddGraphQL(SchemaBuilder.New()
                .AddType(new PaginationAmountType(100))
                .AddQueryType<Query>()
                .AddMutationType<Mutation>()
                .AddAuthorizeDirectiveType()
            );

这就是没有 PaginationAmountType 的样子

然后这就是我添加 PaginationAmountType 时的变化

在此处输入图像描述

我该如何解决这个问题,或者我到底做错了什么,我需要指定每页的最大记录数,但是这种方法会弄乱我的模型。

4

1 回答 1

3

我认为问题在于,PaginationAmount也是基于IntType. 模式发现PaginationType并将其绑定到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/

于 2021-01-21T14:04:21.077 回答