private async Task <TResult> ExecuteAsyncImplementation <TResult>(Func <Task <TResult> > func)
        {
            try
            {
                return(await func().ConfigureAwait(continueOnCapturedContext: false));
            }
            catch (Exception ex)
            {
                if (ExecutionStrategyBase.UnwrapAndHandleException(ex, SqlAzureRetriableExceptionDetector.ShouldRetryOn))
                {
                    throw new EntityException(Strings.TransientExceptionDetected, ex);
                }

                throw;
            }
        }
        public TResult Execute <TResult>(Func <TResult> func)
        {
            if (func == null)
            {
                throw new ArgumentNullException("func");
            }

            try
            {
                return(func());
            }
            catch (Exception ex)
            {
                if (ExecutionStrategyBase.UnwrapAndHandleException(ex, SqlAzureRetriableExceptionDetector.ShouldRetryOn))
                {
                    throw new EntityException(Strings.TransientExceptionDetected, ex);
                }

                throw;
            }
        }