Ejemplo n.º 1
0
        public static async Task ExecuteBatch <T>(CloudTable table, TableOperationType type, IEnumerable <T> entityList)
            where T : ITableEntity
        {
            var operation = new TableBatchOperation();

            foreach (var entity in entityList)
            {
                operation.Execute(type, entity);

                if (operation.Count == MaxBatchCount)
                {
                    await table.ExecuteBatchAsync(operation);

                    operation.Clear();
                }
            }

            if (operation.Count > 0)
            {
                await table.ExecuteBatchAsync(operation);
            }
        }