【发布时间】:2020-08-21 13:06:08
【问题描述】:
如何让MaxExecutionDepth 在 Hot Chocolate GraphQL 中工作?这是我的代码:
// Add GraphQL Services
services.AddGraphQL(
SchemaBuilder.New()
// enable for authorization support
.AddAuthorizeDirectiveType()
.ModifyOptions(o => o.RemoveUnreachableTypes = true)
.Create()
.MakeExecutable(
builder =>
builder
.UseDefaultPipeline()
.AddErrorFilter<UseExceptionMessageErrorFilter>()
.AddOptions(
new QueryExecutionOptions()
{
MaxExecutionDepth = 15
}))
.Schema);
我已经对此进行了测试,甚至将 MaxExecutionDepth 更改为 1,但我仍然可以执行 20 多个深度查询。
【问题讨论】:
-
您是否尝试过移动
Createcall中的使用设置 -
@GuruStron 不确定你的意思;
Create()没有参数。 -
哦,我看错了 API,抱歉。
-
添加了答案,请尝试一下。
标签: c# .net-core graphql hotchocolate