示例#1
0
        public void ExecuteBatch(TableBatchOperation op)
        {
            if (op.Count == 0)
            {
                return;
            }
            if (op.Count <= 100)
            {
                CloudTableContext.ExecuteBatch(op);
                return;
            }
            foreach (var chunk in op.Chunk(100))
            {
                var chunkOp = new TableBatchOperation();
                foreach (var item in chunk)
                {
                    chunkOp.Add(item);
                }

                CloudTableContext.ExecuteBatch(chunkOp);
            }
        }
示例#2
0
        public async Task ExecuteBatchAsync(TableBatchOperation op)
        {
            if (op.Count == 0)
            {
                return;
            }
            if (op.Count <= 100)
            {
                await CloudTableContext.ExecuteBatchAsync(op);

                return;
            }
            foreach (var chunk in op.Chunk(100))
            {
                var chunkOp = new TableBatchOperation();
                foreach (var item in chunk)
                {
                    chunkOp.Add(item);
                }

                await CloudTableContext.ExecuteBatchAsync(chunkOp);
            }
        }