diff --git a/BUILDGUIDE.md b/BUILDGUIDE.md
index 1ebb710197..995be2decf 100644
--- a/BUILDGUIDE.md
+++ b/BUILDGUIDE.md
@@ -245,12 +245,6 @@ Scaled decimal parameter truncation can be enabled by enabling the below AppCont
**"Switch.Microsoft.Data.SqlClient.TruncateScaledDecimal"**
-## Enabling configurable retry logic
-
-To use this feature, you must enable the following AppContext switch at application startup:
-
-**"Switch.Microsoft.Data.SqlClient.EnableRetryLogic"**
-
## Enabling row version null behavior
`SqlDataReader` returns a `DBNull` value instead of an empty `byte[]`. To enable the legacy behavior, you must enable the following AppContext switch on application startup:
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs
index 5329d1ff08..5eea21049c 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs
@@ -506,7 +506,7 @@ private SqlInternalConnectionTds InternalTdsConnection
}
}
- private static bool IsRetryEnabled => LocalAppContextSwitches.IsRetryEnabled;
+ private bool IsProviderRetriable => SqlConfigurableRetryFactory.IsRetriable(RetryLogicProvider);
///
[Browsable(false)]
@@ -1101,7 +1101,7 @@ public override object ExecuteScalar()
statistics = SqlStatistics.StartTimer(Statistics);
WriteBeginExecuteEvent();
SqlDataReader ds;
- ds = IsRetryEnabled ?
+ ds = IsProviderRetriable ?
RunExecuteReaderWithRetry(0, RunBehavior.ReturnImmediately, returnStream: true) :
RunExecuteReader(0, RunBehavior.ReturnImmediately, returnStream: true, method: nameof(ExecuteScalar));
success = true;
@@ -1192,7 +1192,7 @@ public override int ExecuteNonQuery()
{
statistics = SqlStatistics.StartTimer(Statistics);
WriteBeginExecuteEvent();
- if (IsRetryEnabled)
+ if (IsProviderRetriable)
{
InternalExecuteNonQueryWithRetry(sendToPipe: false, timeout: CommandTimeout, out _, asyncWrite: false, inRetry: false);
}
@@ -1706,7 +1706,7 @@ public XmlReader ExecuteXmlReader()
WriteBeginExecuteEvent();
// use the reader to consume metadata
SqlDataReader ds;
- ds = IsRetryEnabled ?
+ ds = IsProviderRetriable ?
RunExecuteReaderWithRetry(CommandBehavior.SequentialAccess, RunBehavior.ReturnImmediately, returnStream: true) :
RunExecuteReader(CommandBehavior.SequentialAccess, RunBehavior.ReturnImmediately, returnStream: true);
success = true;
@@ -2043,7 +2043,7 @@ protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
{
WriteBeginExecuteEvent();
statistics = SqlStatistics.StartTimer(Statistics);
- return IsRetryEnabled ?
+ return IsProviderRetriable ?
RunExecuteReaderWithRetry(behavior, RunBehavior.ReturnImmediately, returnStream: true) :
RunExecuteReader(behavior, RunBehavior.ReturnImmediately, returnStream: true);
}
@@ -2548,7 +2548,7 @@ private SqlDataReader InternalEndExecuteReader(IAsyncResult asyncResult, bool is
///
public override Task ExecuteNonQueryAsync(CancellationToken cancellationToken)
- => IsRetryEnabled ?
+ => IsProviderRetriable ?
InternalExecuteNonQueryWithRetryAsync(cancellationToken) :
InternalExecuteNonQueryAsync(cancellationToken);
@@ -2648,7 +2648,7 @@ protected override Task ExecuteDbDataReaderAsync(CommandBehavior b
///
new public Task ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
- => IsRetryEnabled ?
+ => IsProviderRetriable ?
InternalExecuteReaderWithRetryAsync(behavior, cancellationToken) :
InternalExecuteReaderAsync(behavior, cancellationToken);
@@ -2821,7 +2821,7 @@ public Task ExecuteXmlReaderAsync()
///
public Task ExecuteXmlReaderAsync(CancellationToken cancellationToken)
- => IsRetryEnabled ?
+ => IsProviderRetriable ?
InternalExecuteXmlReaderWithRetryAsync(cancellationToken) :
InternalExecuteXmlReaderAsync(cancellationToken);
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs
index f4594d3ca4..abad0809cb 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs
@@ -114,7 +114,7 @@ private static readonly ConcurrentDictionary> _ColumnEncry
private static readonly Action