Class NpgsqlRetryingExecutionStrategy
An
Namespace: Npgsql.EntityFrameworkCore.PostgreSQL
Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.dll
Syntax
public class NpgsqlRetryingExecutionStrategy : ExecutionStrategy
Remarks
The service lifetime is
See Connection resiliency and database retries for more information and examples.
Constructors
| Improve this Doc View SourceNpgsqlRetryingExecutionStrategy(DbContext, int, TimeSpan, ICollection<string>?)
Creates a new instance of NpgsqlRetryingExecutionStrategy.
Declaration
public NpgsqlRetryingExecutionStrategy(DbContext context, int maxRetryCount, TimeSpan maxRetryDelay, ICollection<string>? errorCodesToAdd)
Parameters
Type | Name | Description |
---|---|---|
DbContext | context | The context on which the operations will be invoked. |
int | maxRetryCount | The maximum number of retry attempts. |
TimeSpan | maxRetryDelay | The maximum delay between retries. |
ICollection<><string>? | errorCodesToAdd | Additional error codes that should be considered transient. |
Remarks
The service lifetime is
See Connection resiliency and database retries for more information and examples.
NpgsqlRetryingExecutionStrategy(DbContext, int)
Creates a new instance of NpgsqlRetryingExecutionStrategy.
Declaration
public NpgsqlRetryingExecutionStrategy(DbContext context, int maxRetryCount)
Parameters
Type | Name | Description |
---|---|---|
DbContext | context | The context on which the operations will be invoked. |
int | maxRetryCount | The maximum number of retry attempts. |
Remarks
The service lifetime is
See Connection resiliency and database retries for more information and examples.
NpgsqlRetryingExecutionStrategy(DbContext)
Creates a new instance of NpgsqlRetryingExecutionStrategy.
Declaration
public NpgsqlRetryingExecutionStrategy(DbContext context)
Parameters
Type | Name | Description |
---|---|---|
DbContext | context | The context on which the operations will be invoked. |
Remarks
The default retry limit is 6, which means that the total amount of time spent before failing is about a minute.
NpgsqlRetryingExecutionStrategy(ExecutionStrategyDependencies, int, TimeSpan, ICollection<string>?)
Creates a new instance of NpgsqlRetryingExecutionStrategy.
Declaration
public NpgsqlRetryingExecutionStrategy(ExecutionStrategyDependencies dependencies, int maxRetryCount, TimeSpan maxRetryDelay, ICollection<string>? errorCodesToAdd)
Parameters
Type | Name | Description |
---|---|---|
ExecutionStrategyDependencies | dependencies | Parameter object containing service dependencies. |
int | maxRetryCount | The maximum number of retry attempts. |
TimeSpan | maxRetryDelay | The maximum delay between retries. |
ICollection<><string>? | errorCodesToAdd | Additional SQL error numbers that should be considered transient. |
Remarks
The service lifetime is
See Connection resiliency and database retries for more information and examples.
NpgsqlRetryingExecutionStrategy(ExecutionStrategyDependencies, int)
Creates a new instance of NpgsqlRetryingExecutionStrategy.
Declaration
public NpgsqlRetryingExecutionStrategy(ExecutionStrategyDependencies dependencies, int maxRetryCount)
Parameters
Type | Name | Description |
---|---|---|
ExecutionStrategyDependencies | dependencies | Parameter object containing service dependencies. |
int | maxRetryCount | The maximum number of retry attempts. |
Remarks
The service lifetime is
See Connection resiliency and database retries for more information and examples.
NpgsqlRetryingExecutionStrategy(ExecutionStrategyDependencies, ICollection<string>?)
Creates a new instance of NpgsqlRetryingExecutionStrategy.
Declaration
public NpgsqlRetryingExecutionStrategy(ExecutionStrategyDependencies dependencies, ICollection<string>? errorCodesToAdd)
Parameters
Type | Name | Description |
---|---|---|
ExecutionStrategyDependencies | dependencies | Parameter object containing service dependencies. |
ICollection<><string>? | errorCodesToAdd | Additional error codes that should be considered transient. |
Remarks
The service lifetime is
See Connection resiliency and database retries for more information and examples.
NpgsqlRetryingExecutionStrategy(ExecutionStrategyDependencies)
Creates a new instance of NpgsqlRetryingExecutionStrategy.
Declaration
public NpgsqlRetryingExecutionStrategy(ExecutionStrategyDependencies dependencies)
Parameters
Type | Name | Description |
---|---|---|
ExecutionStrategyDependencies | dependencies | Parameter object containing service dependencies. |
Remarks
The service lifetime is
See Connection resiliency and database retries for more information and examples.
Methods
| Improve this Doc View SourceShouldRetryOn(Exception?)
Declaration
protected override bool ShouldRetryOn(Exception? exception)
Parameters
Type | Name | Description |
---|---|---|
Exception? | exception |
Returns
Type | Description |
---|---|
bool |
Remarks
The service lifetime is
See Connection resiliency and database retries for more information and examples.