Share via


SqlEngineDbContextOptionsBuilder.EnableRetryOnFailureByDefault Method

Definition

Configures the context to use the default retrying IExecutionStrategy unless it is configured explicitly.

public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlEngineDbContextOptionsBuilder EnableRetryOnFailureByDefault ();
abstract member EnableRetryOnFailureByDefault : unit -> Microsoft.EntityFrameworkCore.Infrastructure.SqlEngineDbContextOptionsBuilder
override this.EnableRetryOnFailureByDefault : unit -> Microsoft.EntityFrameworkCore.Infrastructure.SqlEngineDbContextOptionsBuilder
Public Overridable Function EnableRetryOnFailureByDefault () As SqlEngineDbContextOptionsBuilder

Returns

Remarks

This strategy is specifically tailored to SQL Server, Azure SQL, Azure Synapse. It is pre-configured with error numbers for transient errors that can be retried.

Default values of 6 for the maximum retry count and 30 seconds for the maximum default delay are used.

See Connection resiliency and database retries for more information and examples.

Applies to