public override object Clone()
        {
            var newObj = new SqlRetryLogic(NumberOfTries,
                                           RetryIntervalEnumerator.Clone() as SqlRetryIntervalBaseEnumerator,
                                           TransientPredicate,
                                           PreCondition);

            newObj.RetryIntervalEnumerator.Reset();
            return(newObj);
        }
Beispiel #2
0
        private static SqlRetryLogicBaseProvider InternalCreateRetryProvider(SqlRetryLogicOption retryLogicOption, SqlRetryIntervalBaseEnumerator enumerator)
        {
            if (retryLogicOption == null)
            {
                throw new ArgumentNullException(nameof(retryLogicOption));
            }
            Debug.Assert(enumerator != null, $"The '{nameof(enumerator)}' mustn't be null.");

            var retryLogic = new SqlRetryLogic(retryLogicOption.NumberOfTries, enumerator,
                                               (e) => TransientErrorsCondition(e, retryLogicOption.TransientErrors ?? s_defaultTransientErrors),
                                               retryLogicOption.AuthorizedSqlCondition);

            return(new SqlRetryLogicProvider(retryLogic));
        }
Beispiel #3
0
        /// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConfigurableRetryFactory.xml' path='docs/members[@name="SqlConfigurableRetryFactory"]/CreateNoneRetryProvider/*' />
        public static SqlRetryLogicBaseProvider CreateNoneRetryProvider()
        {
            var retryLogic = new SqlRetryLogic(new SqlNoneIntervalEnumerator(), _ => false);

            return(new SqlRetryLogicProvider(retryLogic));
        }