/// <summary> /// Insert multiple records /// </summary> /// <param name="records">The records to insert</param> public void Insert <T>(IEnumerable <T> records) where T : class, ITableEntity, new() { if (records == null) { throw new ArgumentNullException(nameof(records), "Records cannot be null"); } 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) { entry.ToList().ForEach(x => CloudTable.AddEntity(x)); } }
/// <summary> /// Insert an record /// </summary> /// <param name="record">The record to insert</param> public void Insert(T record) { EnsureRecord(record); CloudTable.AddEntity(record); }
/// <summary> /// Insert an record /// </summary> /// <param name="record">The record to insert</param> public void Insert <T>(T record) where T : class, ITableEntity, new() { EnsureRecord(record); CloudTable.AddEntity(record); }