Table of Contents

Class ResiliencePipelineBuilderExtensions

Namespace
Polly
Assembly
Polly.Core.dll
public static class ResiliencePipelineBuilderExtensions
Inheritance
ResiliencePipelineBuilderExtensions
Inherited Members

Methods

AddPipeline<TResult>(ResiliencePipelineBuilder<TResult>, ResiliencePipeline<TResult>)

Adds an already created pipeline instance to the builder.

public static ResiliencePipelineBuilder<TResult> AddPipeline<TResult>(this ResiliencePipelineBuilder<TResult> builder, ResiliencePipeline<TResult> pipeline)

Parameters

builder ResiliencePipelineBuilder<TResult>

The builder instance.

pipeline ResiliencePipeline<TResult>

The pipeline instance.

Returns

ResiliencePipelineBuilder<TResult>

The same builder instance.

Type Parameters

TResult

The type of the result.

Exceptions

ArgumentNullException

Thrown when pipeline is null.

InvalidOperationException

Thrown when this builder was already used to create a strategy. The builder cannot be modified after it has been used.

AddPipeline<TBuilder>(TBuilder, ResiliencePipeline)

Adds an already created pipeline instance to the builder.

public static TBuilder AddPipeline<TBuilder>(this TBuilder builder, ResiliencePipeline pipeline) where TBuilder : ResiliencePipelineBuilderBase

Parameters

builder TBuilder

The builder instance.

pipeline ResiliencePipeline

The pipeline instance.

Returns

TBuilder

The same builder instance.

Type Parameters

TBuilder

The builder type.

Exceptions

ArgumentNullException

Thrown when pipeline is null.

InvalidOperationException

Thrown when this builder was already used to create a pipeline. The builder cannot be modified after it has been used.

AddStrategy(ResiliencePipelineBuilder, Func<StrategyBuilderContext, ResilienceStrategy<object>>)

Adds a proactive resilience strategy to the builder.

public static ResiliencePipelineBuilder AddStrategy(this ResiliencePipelineBuilder builder, Func<StrategyBuilderContext, ResilienceStrategy<object>> factory)

Parameters

builder ResiliencePipelineBuilder

The builder instance.

factory Func<StrategyBuilderContext, ResilienceStrategy<object>>

The strategy instance.

Returns

ResiliencePipelineBuilder

The same builder instance.

Exceptions

ArgumentNullException

Thrown when builder or factory is null.

InvalidOperationException

Thrown when this builder was already used to create a pipeline. The builder cannot be modified after it has been used.

AddStrategy(ResiliencePipelineBuilder, Func<StrategyBuilderContext, ResilienceStrategy<object>>, ResilienceStrategyOptions)

Adds a reactive strategy to the builder.

public static ResiliencePipelineBuilder AddStrategy(this ResiliencePipelineBuilder builder, Func<StrategyBuilderContext, ResilienceStrategy<object>> factory, ResilienceStrategyOptions options)

Parameters

builder ResiliencePipelineBuilder

The builder instance.

factory Func<StrategyBuilderContext, ResilienceStrategy<object>>

The factory that creates a resilience strategy.

options ResilienceStrategyOptions

The options associated with the strategy.

Returns

ResiliencePipelineBuilder

The same builder instance.

Exceptions

ArgumentNullException

Thrown when builder, factory or options is null.

InvalidOperationException

Thrown when this builder was already used to create a pipeline. The builder cannot be modified after it has been used.

ValidationException

Thrown when options is invalid.

AddStrategy<TResult>(ResiliencePipelineBuilder<TResult>, Func<StrategyBuilderContext, ResilienceStrategy<TResult>>)

Adds a reactive resilience strategy to the builder.

public static ResiliencePipelineBuilder<TResult> AddStrategy<TResult>(this ResiliencePipelineBuilder<TResult> builder, Func<StrategyBuilderContext, ResilienceStrategy<TResult>> factory)

Parameters

builder ResiliencePipelineBuilder<TResult>

The builder instance.

factory Func<StrategyBuilderContext, ResilienceStrategy<TResult>>

The strategy instance.

Returns

ResiliencePipelineBuilder<TResult>

The same builder instance.

Type Parameters

TResult

The result type.

Exceptions

ArgumentNullException

Thrown when builder or factory is null.

InvalidOperationException

Thrown when this builder was already used to create a pipeline. The builder cannot be modified after it has been used.

AddStrategy<TResult>(ResiliencePipelineBuilder<TResult>, Func<StrategyBuilderContext, ResilienceStrategy<TResult>>, ResilienceStrategyOptions)

Adds a reactive strategy to the builder.

public static ResiliencePipelineBuilder<TResult> AddStrategy<TResult>(this ResiliencePipelineBuilder<TResult> builder, Func<StrategyBuilderContext, ResilienceStrategy<TResult>> factory, ResilienceStrategyOptions options)

Parameters

builder ResiliencePipelineBuilder<TResult>

The builder instance.

factory Func<StrategyBuilderContext, ResilienceStrategy<TResult>>

The factory that creates a resilience strategy.

options ResilienceStrategyOptions

The options associated with the strategy.

Returns

ResiliencePipelineBuilder<TResult>

The same builder instance.

Type Parameters

TResult

The type of the result.

Exceptions

ArgumentNullException

Thrown when builder, factory or options is null.

InvalidOperationException

Thrown when this builder was already used to create a pipeline. The builder cannot be modified after it has been used.

ValidationException

Thrown when options is invalid.

AddStrategy<TBuilder>(TBuilder, Func<StrategyBuilderContext, ResilienceStrategy>)

Adds a reactive resilience strategy to the builder.

public static TBuilder AddStrategy<TBuilder>(this TBuilder builder, Func<StrategyBuilderContext, ResilienceStrategy> factory) where TBuilder : ResiliencePipelineBuilderBase

Parameters

builder TBuilder

The builder instance.

factory Func<StrategyBuilderContext, ResilienceStrategy>

The strategy factory.

Returns

TBuilder

The same builder instance.

Type Parameters

TBuilder

The builder type.

Exceptions

ArgumentNullException

Thrown when builder or factory is null.

InvalidOperationException

Thrown when this builder was already used to create a pipeline. The builder cannot be modified after it has been used.

AddStrategy<TBuilder>(TBuilder, Func<StrategyBuilderContext, ResilienceStrategy>, ResilienceStrategyOptions)

Adds a proactive resilience strategy to the builder.

public static TBuilder AddStrategy<TBuilder>(this TBuilder builder, Func<StrategyBuilderContext, ResilienceStrategy> factory, ResilienceStrategyOptions options) where TBuilder : ResiliencePipelineBuilderBase

Parameters

builder TBuilder

The builder instance.

factory Func<StrategyBuilderContext, ResilienceStrategy>

The factory that creates a resilience strategy.

options ResilienceStrategyOptions

The options associated with the strategy.

Returns

TBuilder

The same builder instance.

Type Parameters

TBuilder

The builder type.

Exceptions

ArgumentNullException

Thrown when builder, factory or options is null.

InvalidOperationException

Thrown when this builder was already used to create a pipeline. The builder cannot be modified after it has been used.

ValidationException

Thrown when options is invalid.