private async Task StoreAsync(IEnumerable <Sms> list) { const int maxTryCount = 10; var tryCount = 0; do { try { await _smsRepository.AddManyAsync(list); return; } catch (MongoBulkWriteException ex) { _logger.LogError(ex, "Possible GUID duplication in SMS bulk insert"); foreach (var sms in list) { sms.Id = Guid.NewGuid(); } } }while (tryCount++ < maxTryCount); }
private async Task StoreAsync(IEnumerable <Sms> list) { await _smsRepository.AddManyAsync(list); }