/// <summary> /// Executes the batch at the Azure Cosmos service as an asynchronous operation. /// </summary> /// <param name="requestOptions">Options that apply to the batch. Used only for EPK routing.</param> /// <param name="cancellationToken">(Optional) <see cref="CancellationToken"/> representing request cancellation.</param> /// <returns>An awaitable <see cref="TransactionalBatchResponse"/> which contains the completion status and results of each operation.</returns> public virtual Task <TransactionalBatchResponse> ExecuteAsync( RequestOptions requestOptions, CancellationToken cancellationToken = default(CancellationToken)) { BatchExecutor executor = new BatchExecutor(this.container, this.partitionKey, this.operations, requestOptions); this.operations = new List <ItemBatchOperation>(); return(executor.ExecuteAsync(cancellationToken)); }
internal Task <BatchResponse> ExecuteAsync( int maxServerRequestBodyLength, int maxServerRequestOperationCount, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { BatchExecutor executor = new BatchExecutor(this.container, this.partitionKey, this.operations, requestOptions, maxServerRequestBodyLength, maxServerRequestOperationCount); this.operations = new List <ItemBatchOperation>(); return(executor.ExecuteAsync(cancellationToken)); }
/// <summary> /// Executes the batch at the Azure Cosmos service as an asynchronous operation. /// </summary> /// <param name="requestOptions">Options that apply to the batch. Used only for EPK routing.</param> /// <param name="cancellationToken">(Optional) <see cref="CancellationToken"/> representing request cancellation.</param> /// <returns>An awaitable <see cref="TransactionalBatchResponse"/> which contains the completion status and results of each operation.</returns> public virtual Task <TransactionalBatchResponse> ExecuteAsync( RequestOptions requestOptions, CancellationToken cancellationToken = default(CancellationToken)) { CosmosDiagnosticsContext diagnosticsContext = CosmosDiagnosticsContext.Create(requestOptions); BatchExecutor executor = new BatchExecutor( container: this.container, partitionKey: this.partitionKey, operations: this.operations, batchOptions: requestOptions, diagnosticsContext: diagnosticsContext); this.operations = new List <ItemBatchOperation>(); return(executor.ExecuteAsync(cancellationToken)); }
/// <summary> /// Executes the batch at the Azure Cosmos service as an asynchronous operation. /// </summary> /// <param name="requestOptions">Options that apply to the batch.</param> /// <param name="cancellationToken">(Optional) <see cref="CancellationToken"/> representing request cancellation.</param> /// <returns>An awaitable <see cref="TransactionalBatchResponse"/> which contains the completion status and results of each operation.</returns> public override Task <TransactionalBatchResponse> ExecuteAsync( TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken = default) { return(this.container.ClientContext.OperationHelperAsync( nameof(ExecuteAsync), requestOptions, (trace) => { BatchExecutor executor = new BatchExecutor( container: this.container, partitionKey: this.partitionKey, operations: this.operations, batchOptions: requestOptions); this.operations = new List <ItemBatchOperation>(); return executor.ExecuteAsync(trace, cancellationToken); })); }
/// <summary> /// Executes the batch at the Azure Cosmos service as an asynchronous operation. /// </summary> /// <param name="requestOptions">Options that apply to the batch. Used only for EPK routing.</param> /// <param name="cancellationToken">(Optional) <see cref="CancellationToken"/> representing request cancellation.</param> /// <returns>An awaitable <see cref="TransactionalBatchResponse"/> which contains the completion status and results of each operation.</returns> public virtual Task <TransactionalBatchResponse> ExecuteAsync( RequestOptions requestOptions, CancellationToken cancellationToken = default(CancellationToken)) { return(this.container.ClientContext.OperationHelperAsync( nameof(ExecuteAsync), requestOptions, (diagnostics) => { BatchExecutor executor = new BatchExecutor( container: this.container, partitionKey: this.partitionKey, operations: this.operations, batchOptions: requestOptions, diagnosticsContext: diagnostics); this.operations = new List <ItemBatchOperation>(); return executor.ExecuteAsync(cancellationToken); })); }