public async Task <int> Ingest(IEnumerable <T> source, IngestMode ingestMode, CancellationToken cancel) { var list = source.GroupBy(s => pk.PropertyInfo.GetValue(s).ToString()).Select(g => g.First()).ToList(); var count = list.Count(); logger.LogInformation($"adding {typeof(T).Name}..."); var stopwatch = Stopwatch.StartNew(); var uploader = new NpgsqlBulkUploader(context); await uploader.InsertAsync(list); logger.LogInformation($"it took {stopwatch.Elapsed} to injest {count} records"); return(count); }
public async Task <int> Ingest(List <T> payload, IngestMode ingestMode, CancellationToken cancel) { var itemsAdded = await kustoClient.BulkInsert(kustoSettings.TableName, payload, ingestMode, "id", cancel); return(itemsAdded); }