private async Task ExecuteResolverSeriallyAsync( IExecutionContext executionContext, ResolverTask resolverTask, Action <ResolverTask> enqueueTask, BatchOperationHandler batchOperationHandler, CancellationToken cancellationToken) { resolverTask.Task = ExecuteResolverAsync( resolverTask, executionContext.ErrorHandler, cancellationToken); await CompleteBatchOperationsAsync( new[] { resolverTask.Task }, batchOperationHandler, cancellationToken) .ConfigureAwait(false); resolverTask.ResolverResult = await resolverTask.Task .ConfigureAwait(false); // serialize and integrate result into final query result var completionContext = new CompleteValueContext( executionContext.Services.GetTypeConversion(), executionContext.FieldHelper, enqueueTask); completionContext.CompleteValue(resolverTask); }
private static async Task ExecuteResolverSeriallyAsync( ResolverContext resolverContext, Action <ResolverContext> enqueueNext, BatchOperationHandler batchOperationHandler, IErrorHandler errorHandler, CancellationToken cancellationToken) { resolverContext.Task = ExecuteResolverAsync( resolverContext, errorHandler); if (batchOperationHandler != null) { await CompleteBatchOperationsAsync( new[] { resolverContext }, batchOperationHandler, cancellationToken) .ConfigureAwait(false); } await resolverContext.Task.ConfigureAwait(false); // serialize and integrate result into final query result var completionContext = new CompleteValueContext(enqueueNext); completionContext.CompleteValue(resolverContext); }
private static async Task EndExecuteResolverBatchAsync( IExecutionContext executionContext, IEnumerable <ResolverTask> currentBatch, Action <ResolverTask> enqueueTask, CancellationToken cancellationToken) { var completionContext = new CompleteValueContext( executionContext.Services.GetTypeConversion(), executionContext.FieldHelper, enqueueTask); foreach (ResolverTask resolverTask in currentBatch) { resolverTask.ResolverResult = await resolverTask.Task .ConfigureAwait(false); completionContext.CompleteValue(resolverTask); cancellationToken.ThrowIfCancellationRequested(); } }
private static async Task EndExecuteResolverBatchAsync( IEnumerable <ResolverContext> batch, Action <ResolverContext> enqueueNext, CancellationToken cancellationToken) { var completionContext = new CompleteValueContext(enqueueNext); foreach (ResolverContext resolverContext in batch) { if (resolverContext.Task.Status != TaskStatus.RanToCompletion) { await resolverContext.Task.ConfigureAwait(false); } completionContext.CompleteValue(resolverContext); if (!resolverContext.IsRoot) { ResolverContext.Return(resolverContext); } } }