Table of Contents

Class SqlDataAccessPolicyFactory

Namespace
Excalibur.Data.SqlServer
Assembly
Excalibur.Data.SqlServer.dll

Provides factory methods for creating data access policies with Polly resilience patterns for SQL Server operations.

public class SqlDataAccessPolicyFactory : IDataAccessPolicyFactory
Inheritance
SqlDataAccessPolicyFactory
Implements
Inherited Members

Constructors

SqlDataAccessPolicyFactory(ILogger<SqlDataAccessPolicyFactory>)

Initializes a new instance of the SqlDataAccessPolicyFactory class.

public SqlDataAccessPolicyFactory(ILogger<SqlDataAccessPolicyFactory> logger)

Parameters

logger ILogger<SqlDataAccessPolicyFactory>

The logger instance for logging policy events.

Methods

CreateCircuitBreakerPolicy()

Creates a circuit breaker policy for handling repeated failures.

public IAsyncPolicy CreateCircuitBreakerPolicy()

Returns

IAsyncPolicy

An asynchronous circuit breaker policy for data access operations.

GetComprehensivePolicy()

Gets a comprehensive policy that combines retry and circuit breaker policies.

public IAsyncPolicy GetComprehensivePolicy()

Returns

IAsyncPolicy

An asynchronous policy for comprehensive data access resilience.

Remarks

The wrapped policy is built once and shared. A circuit breaker carries the failure state that decides whether the circuit is open, so a breaker constructed per call starts closed every time and can never trip -- the breaker half of this policy would be decorative. Sharing one instance is what makes the circuit actually break, and it removes a per-call allocation on a data-access hot path as a side effect rather than as the point.

GetRetryPolicy()

Gets a retry policy for transient failures.

public IAsyncPolicy GetRetryPolicy()

Returns

IAsyncPolicy

An asynchronous retry policy for data access operations.