public static async Task <IList <TableResult> > DeleteBatchAsync <T>(this CloudTable table, IEnumerable <T> entities) where T : ITableEntity, new() { if (entities == null) { return(new List <TableResult>()); } var foundEntities = new List <T>(); foreach (var entity in entities) { if (entity.RowKey != null) { var found = await table.RetrieveEntityAsync <T>(entity.PartitionKey, entity.RowKey); if (found != null) { foundEntities.Add(found); } } else { foundEntities.AddRange(await table.RetrieveEntitiesAsync <T>(entity.PartitionKey)); } } return(await table.DeleteExistingEntitiesBatchAsync(foundEntities)); }
public static async Task <IList <TableResult> > DeleteBatchAsync <T>(this CloudTable table, Expression <Func <T, bool> > predicate) where T : ITableEntity, new() { var foundEntities = (await QueryEntitiesAsync(table, predicate)); return(await table.DeleteExistingEntitiesBatchAsync(foundEntities)); }