<PackageReference Include="Polly" Version="5.7.0" />

CircuitBreakerPolicy<TResult>

public class CircuitBreakerPolicy<TResult> : Policy<TResult>, ICircuitBreakerPolicy<TResult>, ICircuitBreakerPolicy, IsPolicy
A circuit-breaker policy that can be applied to delegates returning a value of type TResult.
public CircuitState CircuitState { get; }

Gets the state of the underlying circuit.

public Exception LastException { get; }

Gets the last exception handled by the circuit-breaker. This will be null if no exceptions have been handled by the circuit-breaker since the circuit last closed, or if the last event handled by the circuit was a handled TResult value.

public TResult LastHandledResult { get; }

Gets the last result returned from a user delegate which the circuit-breaker handled. This will be default(TResult) if no results have been handled by the circuit-breaker since the circuit last closed, or if the last event handled by the circuit was an exception.

public void Isolate()

Isolates (opens) the circuit manually, and holds it in this state until a call to Reset is made.

public void Reset()

Closes the circuit, and resets any statistics controlling automated circuit-breaking.