Internal retry logic providers in SqlClient

Applies to: .NET Framework .NET .NET Standard

Download ADO.NET

Built-in, internal retry providers have been implemented for the most common retry patterns. You can use the retry providers by using the following Microsoft.Data.SqlClient.SqlConfigurableRetryFactory static methods:

Note

All of the internal retry providers slightly randomize interval gap times before each retry. This randomization avoids hitting the database at the same time when multiple clients are trying to connect or execute a command with the same configuration.

Warning

Internal retry providers don't support retrying on a command that executes in an open transaction. That operation will execute without retry logic. You can override this behavior by using custom retry logic. For more information, see Configurable retry logic core APIs in SqlClient.

Example

You can find samples for connection and command retry logic at the following links:

See also