Table of Contents

Class PolicyBuilder

Namespace
Polly
Assembly
Polly.dll

Builder class that holds the list of current exception predicates.

public sealed class PolicyBuilder
Inheritance
PolicyBuilder
Inherited Members
Extension Methods

Methods

OrResult<TResult>(Func<TResult, bool>)

Specifies the type of result that this policy can handle with additional filters on the result.

public PolicyBuilder<TResult> OrResult<TResult>(Func<TResult, bool> resultPredicate)

Parameters

resultPredicate Func<TResult, bool>

The predicate to filter the results this policy will handle.

Returns

PolicyBuilder<TResult>

The PolicyBuilder instance.

Type Parameters

TResult

The type of return values this policy will handle.

OrResult<TResult>(TResult)

Specifies a result value which the policy will handle.

public PolicyBuilder<TResult> OrResult<TResult>(TResult result)

Parameters

result TResult

The TResult value this policy will handle.

Returns

PolicyBuilder<TResult>

The PolicyBuilder instance.

Type Parameters

TResult

The type of return values this policy will handle.

Remarks

This policy filter matches the result value returned using .Equals(), ideally suited for value types such as int and enum. To match characteristics of class return types, consider the overload taking a result predicate.

Or<TException>()

Specifies the type of exception that this policy can handle.

public PolicyBuilder Or<TException>() where TException : Exception

Returns

PolicyBuilder

The PolicyBuilder instance.

Type Parameters

TException

The type of the exception to handle.

Or<TException>(Func<TException, bool>)

Specifies the type of exception that this policy can handle with additional filters on this exception type.

public PolicyBuilder Or<TException>(Func<TException, bool> exceptionPredicate) where TException : Exception

Parameters

exceptionPredicate Func<TException, bool>

The exception predicate to filter the type of exception this policy can handle.

Returns

PolicyBuilder

The PolicyBuilder instance.

Type Parameters

TException

The type of the exception.