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.

C#
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure ();

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

Entity Framework Core 9.0 i druge verzije
Proizvod Verzije
Entity Framework Core 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

EnableRetryOnFailure(ICollection<Int32>)

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

Configures the context to use the default retrying IExecutionStrategy.

C#
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure (System.Collections.Generic.ICollection<int> errorNumbersToAdd);

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

Entity Framework Core 9.0 i druge verzije
Proizvod Verzije
Entity Framework Core 7.0, 8.0, 9.0

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.

C#
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure (int maxRetryCount);

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

Entity Framework Core 9.0 i druge verzije
Proizvod Verzije
Entity Framework Core 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

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.

C#
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure (int maxRetryCount, TimeSpan maxRetryDelay, System.Collections.Generic.ICollection<int> errorNumbersToAdd);
C#
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure (int maxRetryCount, TimeSpan maxRetryDelay, System.Collections.Generic.ICollection<int>? errorNumbersToAdd);

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

Entity Framework Core 6.0 i druge verzije
Proizvod Verzije
Entity Framework Core 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0

EnableRetryOnFailure(Int32, TimeSpan, IEnumerable<Int32>)

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

Configures the context to use the default retrying IExecutionStrategy.

C#
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder EnableRetryOnFailure (int maxRetryCount, TimeSpan maxRetryDelay, System.Collections.Generic.IEnumerable<int>? errorNumbersToAdd);

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 Core 9.0 i druge verzije
Proizvod Verzije
Entity Framework Core 7.0, 8.0, 9.0