Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
SqlServerDbContextOptionsBuilder.EnableRetryOnFailure Method
Definition
- Namespace:
- Microsoft.EntityFrameworkCore.Infrastructure
- Assembly:
- Microsoft.EntityFrameworkCore.SqlServer.dll
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v1.1.6
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v10.0.0
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v2.0.3
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v2.1.11
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v2.2.6
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v3.0.0
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v3.1.0
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v5.0.0
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v6.0.0
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v7.0.0
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v8.0.0
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v9.0.0
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| EnableRetryOnFailure() |
Configures the context to use the default retrying IExecutionStrategy. |
| EnableRetryOnFailure(ICollection<Int32>) |
Configures the context to use the default retrying IExecutionStrategy. |
| EnableRetryOnFailure(Int32) |
Configures the context to use the default retrying IExecutionStrategy. |
| EnableRetryOnFailure(Int32, TimeSpan, ICollection<Int32>) |
Configures the context to use the default retrying IExecutionStrategy. This strategy is specifically tailored to SQL Server (including SQL Azure). It is pre-configured with error numbers for transient errors that can be retried, but additional error numbers can also be supplied. |
| EnableRetryOnFailure(Int32, TimeSpan, IEnumerable<Int32>) |
Configures the context to use the default retrying IExecutionStrategy. |
EnableRetryOnFailure()
Configures the context to use the default retrying IExecutionStrategy.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure();
abstract member EnableRetryOnFailure : unit -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
override this.EnableRetryOnFailure : unit -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
Public Overridable Function EnableRetryOnFailure () As SqlServerDbContextOptionsBuilder
Returns
Remarks
This strategy is specifically tailored to SQL Server. 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
EnableRetryOnFailure(ICollection<Int32>)
Configures the context to use the default retrying IExecutionStrategy.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure(System.Collections.Generic.ICollection<int> errorNumbersToAdd);
abstract member EnableRetryOnFailure : System.Collections.Generic.ICollection<int> -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
override this.EnableRetryOnFailure : System.Collections.Generic.ICollection<int> -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
Public Overridable Function EnableRetryOnFailure (errorNumbersToAdd As ICollection(Of Integer)) As SqlServerDbContextOptionsBuilder
Parameters
- errorNumbersToAdd
- ICollection<Int32>
Additional SQL error numbers that should be considered transient.
Returns
Remarks
This strategy is specifically tailored to SQL Server. 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
EnableRetryOnFailure(Int32)
Configures the context to use the default retrying IExecutionStrategy.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure(int maxRetryCount);
abstract member EnableRetryOnFailure : int -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
override this.EnableRetryOnFailure : int -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
Public Overridable Function EnableRetryOnFailure (maxRetryCount As Integer) As SqlServerDbContextOptionsBuilder
Parameters
- maxRetryCount
- Int32
Returns
Remarks
This strategy is specifically tailored to SQL Server. It is pre-configured with error numbers for transient errors that can be retried.
A default value 30 seconds for the maximum default delay is used.
See Connection resiliency and database retries for more information and examples.
Applies to
EnableRetryOnFailure(Int32, TimeSpan, ICollection<Int32>)
Configures the context to use the default retrying IExecutionStrategy.
This strategy is specifically tailored to SQL Server (including SQL Azure). It is pre-configured with error numbers for transient errors that can be retried, but additional error numbers can also be supplied.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure(int maxRetryCount, TimeSpan maxRetryDelay, System.Collections.Generic.ICollection<int> errorNumbersToAdd);
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure(int maxRetryCount, TimeSpan maxRetryDelay, System.Collections.Generic.ICollection<int>? errorNumbersToAdd);
abstract member EnableRetryOnFailure : int * TimeSpan * System.Collections.Generic.ICollection<int> -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
override this.EnableRetryOnFailure : int * TimeSpan * System.Collections.Generic.ICollection<int> -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
Public Overridable Function EnableRetryOnFailure (maxRetryCount As Integer, maxRetryDelay As TimeSpan, errorNumbersToAdd As ICollection(Of Integer)) As SqlServerDbContextOptionsBuilder
Parameters
- maxRetryCount
- Int32
The maximum number of retry attempts.
- maxRetryDelay
- TimeSpan
The maximum delay between retries.
- errorNumbersToAdd
- ICollection<Int32>
Additional SQL error numbers that should be considered transient.
Returns
Remarks
See Connection resiliency and database retries for more information.
Applies to
EnableRetryOnFailure(Int32, TimeSpan, IEnumerable<Int32>)
Configures the context to use the default retrying IExecutionStrategy.
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure(int maxRetryCount, TimeSpan maxRetryDelay, System.Collections.Generic.IEnumerable<int>? errorNumbersToAdd);
abstract member EnableRetryOnFailure : int * TimeSpan * seq<int> -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
override this.EnableRetryOnFailure : int * TimeSpan * seq<int> -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
Public Overridable Function EnableRetryOnFailure (maxRetryCount As Integer, maxRetryDelay As TimeSpan, errorNumbersToAdd As IEnumerable(Of Integer)) As SqlServerDbContextOptionsBuilder
Parameters
- maxRetryCount
- Int32
The maximum number of retry attempts.
- maxRetryDelay
- TimeSpan
The maximum delay between retries.
- errorNumbersToAdd
- IEnumerable<Int32>
Additional SQL error numbers that should be considered transient.
Returns
Remarks
This strategy is specifically tailored to SQL Server. It is pre-configured with error numbers for transient errors that can be retried, but additional error numbers can also be supplied.
See Connection resiliency and database retries for more information and examples.
Applies to
Entity Framework
Feedback
Was this page helpful?
