Partilhar via


SqlServerDbContextOptionsBuilder.EnableRetryOnFailure Method

Definition

Overloads

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()

Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs

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>)

Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs

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)

Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs

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>)

Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs

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>)

Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs
Source:
SqlServerDbContextOptionsBuilder.cs

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