/// <summary>
 /// Executes the specified sql action with the specified settings. This is
 /// for Sql data retrieval statements.
 /// </summary>
 /// <typeparam name="TReturnType">The type of the return value.</typeparam>
 /// <param name="retrySettings">The retry settings.</param>
 /// <param name="methodDescriptor">The method descriptor.</param>
 /// <param name="sqlAction">The sql action.</param>
 /// <returns></returns>
 public static async Task <TReturnType> Execute <TReturnType>(
     RetrySettings retrySettings,
     Func <string>
     methodDescriptor,
     Func <Task <TReturnType> > sqlAction)
 {
     return(await new SqlDataAccessHandler <TReturnType>(
                retrySettings,
                methodDescriptor,
                sqlAction)
            .Execute());
 }
        /// <summary>
        /// Instantiates a SqlDataAccessHandler of type TReturn.
        /// </summary>
        /// <param name="retrySettings">The retry settings.</param>
        /// <param name="methodDescriptor">The method descriptor. Used for error logging.</param>
        /// <param name="awaitableAction">The data access code that should be guarded.</param>
        /// <exception cref="System.ArgumentNullException">
        /// methodDescriptor or action
        /// </exception>
        public SqlDataAccessHandler(
            RetrySettings retrySettings,
            Func <string> methodDescriptor,
            Func <Task <TReturn> > awaitableAction)
        {
            if (methodDescriptor == null)
            {
                throw new ArgumentNullException("methodDescriptor");
            }
            if (awaitableAction == null)
            {
                throw new ArgumentNullException("awaitableAction");
            }

            this.retrySettings    = retrySettings;
            this.methodDescriptor = methodDescriptor;
            this.awaitableAction  = awaitableAction;
        }