private static async Task <object> ExecuteFieldMiddlewareAsync( ResolverTask resolverTask) { if (resolverTask.FieldSelection.Field.Resolver == null) { return(null); } object result = await resolverTask.FieldSelection.Field.Resolver( resolverTask.ResolverContext); return(resolverTask.CompleteResolverResult(result)); }
private static async Task <object> ExecuteFieldMiddlewareAsync( ResolverTask resolverTask) { var middlewareContext = new MiddlewareContext ( resolverTask.ResolverContext, () => resolverTask.FieldSelection.Field .Resolver?.Invoke(resolverTask.ResolverContext) ?? Task.FromResult <object>(null), result => resolverTask.CompleteResolverResult(result) ); await resolverTask.FieldDelegate.Invoke(middlewareContext) .ConfigureAwait(false); return(middlewareContext.Result); }