Class for writing/deleting a batch of items in multiple DynamoDB tables, using multiple strongly-typed BatchWrite objects
        /// <summary>
        /// Issues a batch-write request with multiple batches.
        /// </summary>
        /// <param name="batches">
        /// Configured BatchWrite objects
        /// </param>
        internal void ExecuteBatchWrite(params BatchWrite[] batches)
        {
            DynamoDBAsyncExecutor.IsMainThread("ExecuteBatchWriteAsync");
            MultiTableBatchWrite superBatch = new MultiTableBatchWrite(batches);

            superBatch.Execute();
        }
 /// <summary>
 /// Initiates the asynchronous execution of the ExecuteBatchWrite operation.
 /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.ExecuteBatchWrite"/>
 /// </summary>
 /// <param name="batches">Configured BatchWrite objects</param>
 /// <param name="callback">An AmazonDynamoCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// <returns>void</returns>
 public void ExecuteBatchWriteAsync(BatchWrite[] batches, AmazonDynamoCallback <VoidResponse> callback, object state)
 {
     DynamoDBAsyncExecutor.AsyncOperation <VoidResponse>(() =>
     {
         MultiTableBatchWrite superBatch = new MultiTableBatchWrite(batches);
         superBatch.ExecuteHelper(true);
         return(new VoidResponse());
     }, "ExecuteBatchWriteAsync", callback, state);
 }
示例#3
0
        /// <summary>
        /// Initiates the asynchronous execution of the ExecuteBatchWrite operation.
        /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.ExecuteBatchWrite"/>
        /// </summary>
        /// <param name="batches">Configured BatchWrite objects</param>
        /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param>
        /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param>
        public void ExecuteBatchWriteAsync <T>(BatchWrite[] batches, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
        {
            asyncOptions = asyncOptions ?? new AsyncOptions();
            MultiTableBatchWrite superBatch = new MultiTableBatchWrite(batches);

            DynamoDBAsyncExecutor.ExecuteAsync(
                () => { superBatch.ExecuteHelper(true); },
                asyncOptions,
                callback);
        }
示例#4
0
        /// <summary>
        /// Issues a batch-write request with multiple batches.
        /// </summary>
        /// <param name="batches">
        /// Configured BatchWrite objects
        /// </param>
        public void ExecuteBatchWrite(params BatchWrite[] batches)
        {
            MultiTableBatchWrite superBatch = new MultiTableBatchWrite(batches);

            superBatch.Execute();
        }
        /// <summary>
        /// Initiates the asynchronous execution of the ExecuteBatchWrite operation.
        /// <seealso cref="Amazon.DynamoDBv2.DataModel.DynamoDBContext.ExecuteBatchWrite"/>
        /// </summary>
        /// <param name="batches">Configured BatchWrite objects</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDelete
        ///         operation.</returns>
        public IAsyncResult BeginExecuteBatchWrite(BatchWrite[] batches, AsyncCallback callback, object state)
        {
            MultiTableBatchWrite superBatch = new MultiTableBatchWrite(batches);

            return(DynamoDBAsyncExecutor.BeginOperation(() => { superBatch.ExecuteHelper(); return null; }, callback, state));
        }
示例#6
0
        /// <summary>
        /// Issues a batch-write request with multiple batches.
        /// </summary>
        /// <param name="batches">
        /// Configured BatchWrite objects
        /// </param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        public Task ExecuteBatchWriteAsync(BatchWrite[] batches, CancellationToken cancellationToken = default(CancellationToken))
        {
            MultiTableBatchWrite superBatch = new MultiTableBatchWrite(batches);

            return(superBatch.ExecuteAsync(cancellationToken));
        }