diff --git a/src/OrchardCore/OrchardCore.Apis.GraphQL.Abstractions/Resolvers/LockedAsyncFieldResolver.cs b/src/OrchardCore/OrchardCore.Apis.GraphQL.Abstractions/Resolvers/LockedAsyncFieldResolver.cs index 2a4f42a24e4..85ab7e60be9 100644 --- a/src/OrchardCore/OrchardCore.Apis.GraphQL.Abstractions/Resolvers/LockedAsyncFieldResolver.cs +++ b/src/OrchardCore/OrchardCore.Apis.GraphQL.Abstractions/Resolvers/LockedAsyncFieldResolver.cs @@ -3,21 +3,24 @@ namespace OrchardCore.Apis.GraphQL.Resolvers; -public class LockedAsyncFieldResolver : FuncFieldResolver +public class LockedAsyncFieldResolver : IFieldResolver { - public LockedAsyncFieldResolver(Func> resolver) : base(resolver) - { + private readonly Func> _resolver; + public LockedAsyncFieldResolver(Func> resolver) + { + ArgumentNullException.ThrowIfNull(resolver); + _resolver = resolver; } - public new async ValueTask ResolveAsync(IResolveFieldContext context) + public async ValueTask ResolveAsync(IResolveFieldContext context) { var graphContext = (GraphQLUserContext)context.UserContext; await graphContext.ExecutionContextLock.WaitAsync(); try { - return await base.ResolveAsync(context); + return await _resolver(context).ConfigureAwait(false); } finally { @@ -26,20 +29,24 @@ public LockedAsyncFieldResolver(Func : FuncFieldResolver +public class LockedAsyncFieldResolver : IFieldResolver { - public LockedAsyncFieldResolver(Func, ValueTask> resolver) : base(resolver) + private readonly Func, ValueTask> _resolver; + + public LockedAsyncFieldResolver(Func, ValueTask> resolver) { + ArgumentNullException.ThrowIfNull(resolver); + _resolver = resolver; } - public new async Task ResolveAsync(IResolveFieldContext context) + public async ValueTask ResolveAsync(IResolveFieldContext context) { var graphContext = (GraphQLUserContext)context.UserContext; await graphContext.ExecutionContextLock.WaitAsync(); try { - return await base.ResolveAsync(context); + return await _resolver(context.As()).ConfigureAwait(false); } finally {