Esempio n. 1
0
        public static async Task <IList <TableResult> > ExecuteBatchAsLimitedBatches(
            this CloudTable table,
            TableBatchOperation batch)
        {
            if (batch.Count < 1)
            {
                return(new List <TableResult>());
            }

            if (batch.Count <= MaxBatchSize)
            {
                return(await table.ExecuteBatchAsync(batch));
            }

            var result = new List <TableResult>();
            var limitedBatchOperationLists = batch.ChunkBy(MaxBatchSize);

            foreach (var limitedBatchOperationList in limitedBatchOperationLists)
            {
                var limitedBatch       = CreateLimitedTableBatchOperation(limitedBatchOperationList);
                var limitedBatchResult = await table.ExecuteBatchAsync(limitedBatch);

                result.AddRange(limitedBatchResult);
            }

            return(result);
        }
        protected virtual IEnumerable <List <TableOperation> > GetLimitedBatchOperationLists(TableBatchOperation batch)
        {
            // this is no longer public

            return(batch.ChunkBy(TableServiceBatchMaximumOperations));
        }