Search Results for

    Show / Hide Table of Contents

    Class NpgsqlRetryingExecutionStrategy

    An implementation for retrying failed executions on PostgreSQL.

    Inheritance
    object
    NpgsqlRetryingExecutionStrategy
    Namespace: Npgsql.EntityFrameworkCore.PostgreSQL
    Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.dll
    Syntax
    public class NpgsqlRetryingExecutionStrategy : ExecutionStrategy
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

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

    Constructors

    | Improve this Doc View Source

    NpgsqlRetryingExecutionStrategy(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 . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

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

    | Improve this Doc View Source

    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 . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

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

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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 . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

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

    | Improve this Doc View Source

    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 . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

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

    | Improve this Doc View Source

    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 . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

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

    | Improve this Doc View Source

    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 . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

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

    Methods

    | Improve this Doc View Source

    ShouldRetryOn(Exception?)

    Declaration
    protected override bool ShouldRetryOn(Exception? exception)
    Parameters
    Type Name Description
    Exception? exception
    Returns
    Type Description
    bool
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

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

    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright 2023 The Npgsql Development Team