Exemple #1
0
        /// <summary>
        /// Processes asynchrounously the specified action with possibilty to retry on error.
        /// </summary>
        /// <param name="exceptionService">The exception service.</param>
        /// <param name="action">The action.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="exceptionService"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="action"/> is <c>null</c>.</exception>
        public static Task ProcessWithRetryAsync(this IExceptionService exceptionService, Task action)
        {
            Argument.IsNotNull("exceptionService", exceptionService);
            Argument.IsNotNull("action", action);

            return(exceptionService.ProcessWithRetryAsync(async() => { await action.ConfigureAwait(false); return default(object); }));
        }
Exemple #2
0
        /// <summary>
        /// Processes asynchrounously the specified action with possibilty to retry on error.
        /// </summary>
        /// <param name="exceptionService">The exception service.</param>
        /// <param name="action">The action.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">The <paramref name="action"/> is <c>null</c>.</exception>
        /// <exception cref="Exception">A delegate callback throws an exception.</exception>
        public static Task ProcessWithRetryAsync(this IExceptionService exceptionService, Func <Task> action)
        {
            Argument.IsNotNull("exceptionService", exceptionService);
            Argument.IsNotNull("action", action);

            return(exceptionService.ProcessWithRetryAsync(async() =>
            {
                await action().ConfigureAwait(TaskHelper.DefaultConfigureAwaitValue);
                return default(object);
            }));
        }