NET的GraphQL-取消令牌

有没有办法在graphql端点中传递取消令牌?

public class GetaccountQuery : ObjectGraphType
{ public GetaccountQuery(IRolver resolver)
        {
            FieldAsync<UserType>(
                "Getaccount",arguments: new QueryArguments(
                    new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "userId" },resolve: async context => await resolver.ResolveAsync(context,pass in cancellation token ?? ));
        }
}
yinghuochong512 回答:NET的GraphQL-取消令牌

找到答案,将IHttpContextAccessor注入GetAccountQuery ctor中,然后像下面这样从httpcontext访问Cancellation令牌:

HttpContextAccessor.HttpContext.RequestAborted 
本文链接:https://www.f2er.com/3127054.html

大家都在问