private async Task <BulkWriteBatchResult> ExecuteBatchAsync(RetryableWriteContext context, Batch batch, CancellationToken cancellationToken)
        {
            var operation       = CreateBatchOperation(batch);
            var operationResult = await RetryableWriteOperationExecutor.ExecuteAsync(operation, context, cancellationToken).ConfigureAwait(false);

            return(CreateBatchResult(batch, operationResult));
        }
        private async Task <BulkWriteBatchResult> ExecuteBatchAsync(RetryableWriteContext context, Batch batch, CancellationToken cancellationToken)
        {
            var          operation = CreateBatchOperation(batch);
            BsonDocument operationResult;

            try
            {
                operationResult = await RetryableWriteOperationExecutor.ExecuteAsync(operation, context, cancellationToken).ConfigureAwait(false);
            }
            catch (MongoWriteConcernException exception) when(exception.IsWriteConcernErrorOnly())
            {
                operationResult = exception.Result;
            }
            return(CreateBatchResult(batch, operationResult));
        }
 /// <inheritdoc />
 public virtual Task <BsonDocument> ExecuteAsync(RetryableWriteContext context, CancellationToken cancellationToken)
 {
     return(RetryableWriteOperationExecutor.ExecuteAsync(this, context, cancellationToken));
 }
示例#4
0
 /// <inheritdoc/>
 public Task <TResult> ExecuteAsync(RetryableWriteContext context, CancellationToken cancellationToken)
 {
     return(RetryableWriteOperationExecutor.ExecuteAsync(this, context, cancellationToken));
 }
示例#5
0
 /// <inheritdoc/>
 public Task <TResult> ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken)
 {
     return(RetryableWriteOperationExecutor.ExecuteAsync(this, binding, _retryRequested, cancellationToken));
 }