ResiliencePipelineProvider<TKey>
Represents a provider for resilience pipelines that are accessible by TKey.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
namespace Polly.Registry
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public abstract class ResiliencePipelineProvider<TKey>
{
public virtual ResiliencePipeline GetPipeline(TKey key)
{
if (TryGetPipeline(key, out ResiliencePipeline pipeline))
return pipeline;
throw new KeyNotFoundException($"""{key}""" + "Please ensure that either the resilience pipeline or the builder is registered.");
}
public virtual ResiliencePipeline<TResult> GetPipeline<[System.Runtime.CompilerServices.Nullable(2)] TResult>(TKey key)
{
if (TryGetPipeline(key, out ResiliencePipeline<TResult> pipeline))
return pipeline;
throw new KeyNotFoundException($"""{typeof(TResult).Name}""{key}""" + "Please ensure that either the generic resilience pipeline or the generic builder is registered.");
}
public abstract bool TryGetPipeline(TKey key, [System.Runtime.CompilerServices.Nullable(2)] [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out ResiliencePipeline pipeline);
public abstract bool TryGetPipeline<[System.Runtime.CompilerServices.Nullable(2)] TResult>(TKey key, [System.Runtime.CompilerServices.Nullable(new byte[] {
2,
1
})] [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out ResiliencePipeline<TResult> pipeline);
}
}