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;
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(144, 1);
defaultInterpolatedStringHandler.AppendLiteral("Unable to find a resilience pipeline associated with the key '");
defaultInterpolatedStringHandler.AppendFormatted<TKey>(key);
defaultInterpolatedStringHandler.AppendLiteral("'. ");
defaultInterpolatedStringHandler.AppendLiteral("Please ensure that either the resilience pipeline or the builder is registered.");
throw new KeyNotFoundException(defaultInterpolatedStringHandler.ToStringAndClear());
}
public virtual ResiliencePipeline<TResult> GetPipeline<[System.Runtime.CompilerServices.Nullable(2)] TResult>(TKey key)
{
if (TryGetPipeline(key, out ResiliencePipeline<TResult> pipeline))
return pipeline;
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(174, 2);
defaultInterpolatedStringHandler.AppendLiteral("Unable to find a generic resilience pipeline of '");
defaultInterpolatedStringHandler.AppendFormatted(typeof(TResult).Name);
defaultInterpolatedStringHandler.AppendLiteral("' associated with the key '");
defaultInterpolatedStringHandler.AppendFormatted<TKey>(key);
defaultInterpolatedStringHandler.AppendLiteral("'. ");
defaultInterpolatedStringHandler.AppendLiteral("Please ensure that either the generic resilience pipeline or the generic builder is registered.");
throw new KeyNotFoundException(defaultInterpolatedStringHandler.ToStringAndClear());
}
public abstract bool TryGetPipeline(TKey key, [System.Runtime.CompilerServices.Nullable(2)] [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
})] [NotNullWhen(true)] out ResiliencePipeline<TResult> pipeline);
}
}