/// <summary> /// Sets the specified short URL as key with fullUrl value /// </summary> /// <param name="shortUrl">The short URL.</param> /// <param name="fullUrl">The full URL.</param> /// <returns></returns> public bool Set(string shortUrl, string fullUrl) { var item = new UrlItemTableEntity(shortUrl, fullUrl); return RetrySet(item); }
/// <summary> /// Retries the set operation. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> /// <exception cref="AggregateException"></exception> private bool RetrySet(UrlItemTableEntity item) { var exceptions = new List<Exception>(); for (int retry = 0; retry < _retryCount; retry++) { try { if (retry > 0) Thread.Sleep(_retryInterval); return azureStore.Insert(item); } catch (Exception ex) { exceptions.Add(ex); } } throw new AggregateException(exceptions); }