/// <summary> /// Insert multiple records /// </summary> /// <param name="records">The records to insert</param> public async Task InsertAsync <T>(IEnumerable <T> records) where T : class, ITableEntity, new() { if (records == null) { throw new ArgumentNullException(nameof(records)); } var partitionKeySeparation = records.GroupBy(x => x.PartitionKey) .OrderBy(g => g.Key) .Select(g => g.AsEnumerable()).SelectMany(entry => entry.Partition(MaxPartitionSize)).ToList(); foreach (var entry in partitionKeySeparation) { await foreach (T qEntity in entry.ToAsyncEnumerable()) { await CloudTable.AddEntityAsync(qEntity); } } }
/// <summary> /// Insert an record /// </summary> /// <param name="record">The record to insert</param> public Task InsertAsync(T record) { EnsureRecord(record); return(CloudTable.AddEntityAsync(record)); }
/// <summary> /// Insert an record /// </summary> /// <param name="record">The record to insert</param> public Task InsertAsync <T>(T record) where T : class, ITableEntity, new() { EnsureRecord(record); return(CloudTable.AddEntityAsync(record)); }