Interface IApizrGlobalSharedOptionsBuilderBase<TApizrOptions, TApizrOptionsBuilder>
- Namespace
- Apizr.Configuring.Shared
- Assembly
- Apizr.dll
Builder options available at all (common, proper and request) levels and for all (static and extended) registration types
public interface IApizrGlobalSharedOptionsBuilderBase<out TApizrOptions, out TApizrOptionsBuilder> : IApizrGlobalSharedOptionsBuilderBase where TApizrOptions : IApizrGlobalSharedOptionsBase where TApizrOptionsBuilder : IApizrGlobalSharedOptionsBuilderBase<out TApizrOptions, out TApizrOptionsBuilder>
Type Parameters
TApizrOptions
TApizrOptionsBuilder
- Extension Methods
Methods
WithCaching(CacheMode, TimeSpan?, bool)
Cache data.
TApizrOptionsBuilder WithCaching(CacheMode mode = CacheMode.FetchOrGet, TimeSpan? lifeSpan = null, bool shouldInvalidateOnError = false)
Parameters
mode
CacheModeFetchOrGet returns fresh data when request succeed otherwise cached one, where GetOrFetch returns cached data if we get some otherwise fresh one
lifeSpan
TimeSpan?This specific caching lifetime (Default: null = cache handler lifetime
shouldInvalidateOnError
boolShould invalidate on error (Default: false)
Returns
- TApizrOptionsBuilder
WithExCatching(Action<ApizrException>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
[Obsolete("Catching an exception by an Action is now replaced by a Func returning a handled boolean flag")]
TApizrOptionsBuilder WithExCatching(Action<ApizrException> onException, bool letThrowOnException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onException
Action<ApizrException>The exception callback
letThrowOnException
boolLet throw potential exception (default: true)
strategy
ApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
- TApizrOptionsBuilder
WithExCatching(Func<ApizrException, bool>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
TApizrOptionsBuilder WithExCatching(Func<ApizrException, bool> onException, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onException
Func<ApizrException, bool>The exception callback returning handled boolean flag
letThrowOnHandledException
boolLet throw potential exception even if it's handled (default: true)
strategy
ApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
- TApizrOptionsBuilder
WithExCatching(Func<ApizrException, Task<bool>>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
TApizrOptionsBuilder WithExCatching(Func<ApizrException, Task<bool>> onException, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onException
Func<ApizrException, Task<bool>>The exception callback returning handled boolean flag Task
letThrowOnHandledException
boolLet throw potential exception even if it's handled (default: true)
strategy
ApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
- TApizrOptionsBuilder
WithExCatching<TResult>(Action<ApizrException<TResult>>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
[Obsolete("Catching an exception by an Action is now replaced by a Func returning a handled boolean flag")]
TApizrOptionsBuilder WithExCatching<TResult>(Action<ApizrException<TResult>> onException, bool letThrowOnException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onException
Action<ApizrException<TResult>>The exception callback
letThrowOnException
boolLet throw potential exception (default: true)
strategy
ApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
- TApizrOptionsBuilder
Type Parameters
TResult
WithExCatching<TResult>(Func<ApizrException<TResult>, bool>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
TApizrOptionsBuilder WithExCatching<TResult>(Func<ApizrException<TResult>, bool> onException, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onException
Func<ApizrException<TResult>, bool>The exception callback returning handled boolean flag
letThrowOnHandledException
boolLet throw potential exception even if it's handled (default: true)
strategy
ApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
- TApizrOptionsBuilder
Type Parameters
TResult
WithExCatching<TResult>(Func<ApizrException<TResult>, Task<bool>>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
TApizrOptionsBuilder WithExCatching<TResult>(Func<ApizrException<TResult>, Task<bool>> onException, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onException
Func<ApizrException<TResult>, Task<bool>>The exception callback returning a handled boolean flag Task
letThrowOnHandledException
boolLet throw potential exception even if it's handled (default: true)
strategy
ApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
- TApizrOptionsBuilder
Type Parameters
TResult
WithExCatching<THandler>(THandler, bool, ApizrDuplicateStrategy)
Catch potential exceptions
TApizrOptionsBuilder WithExCatching<THandler>(THandler exceptionHandler, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace) where THandler : IApizrExceptionHandler
Parameters
exceptionHandler
THandlerThe exception handler called back and returning handled boolean flag Task
letThrowOnHandledException
boolLet throw potential exception even if it's handled (default: true)
strategy
ApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
- TApizrOptionsBuilder
Type Parameters
THandler
WithHandlerParameter(string, object)
Set some parameters passed through all delegating handlers
TApizrOptionsBuilder WithHandlerParameter(string key, object value)
Parameters
Returns
- TApizrOptionsBuilder
WithLoggedHeadersRedactionNames(IEnumerable<string>, ApizrDuplicateStrategy)
Sets the collection of HTTP headers names for which values should be redacted before logging.
TApizrOptionsBuilder WithLoggedHeadersRedactionNames(IEnumerable<string> redactedLoggedHeaderNames, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Add)
Parameters
redactedLoggedHeaderNames
IEnumerable<string>The collection of HTTP headers names for which values should be redacted before logging.
strategy
ApizrDuplicateStrategyThe duplicate strategy if there's any other names already (default: Add)
Returns
- TApizrOptionsBuilder
WithLoggedHeadersRedactionRule(Func<string, bool>, ApizrDuplicateStrategy)
Sets the Func<T, TResult> which determines whether to redact the HTTP header value before logging.
TApizrOptionsBuilder WithLoggedHeadersRedactionRule(Func<string, bool> shouldRedactHeaderValue, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Add)
Parameters
shouldRedactHeaderValue
Func<string, bool>The Func<T, TResult> which determines whether to redact the HTTP header value before logging
strategy
ApizrDuplicateStrategyThe duplicate strategy if there's any other names already (default: Add)
Returns
- TApizrOptionsBuilder
WithLogging(HttpTracerMode, HttpMessageParts, params LogLevel[])
Define tracer mode, http traffic tracing verbosity and log levels (could be defined with LogAttribute)
TApizrOptionsBuilder WithLogging(HttpTracerMode httpTracerMode = HttpTracerMode.Everything, HttpMessageParts trafficVerbosity = HttpMessageParts.All, params LogLevel[] logLevels)
Parameters
httpTracerMode
HttpTracerModetrafficVerbosity
HttpMessagePartsHttp traffic tracing verbosity (default: All)
logLevels
LogLevel[]Log levels to apply while writing (default: Information)
Returns
- TApizrOptionsBuilder
WithOperationTimeout(TimeSpan)
Set a timeout to the operation (overall request tries)
TApizrOptionsBuilder WithOperationTimeout(TimeSpan timeout)
Parameters
timeout
TimeSpanThe operation timeout
Returns
- TApizrOptionsBuilder
WithRequestTimeout(TimeSpan)
Set a timeout to the request (each request try)
TApizrOptionsBuilder WithRequestTimeout(TimeSpan timeout)
Parameters
timeout
TimeSpanThe request timeout
Returns
- TApizrOptionsBuilder
WithResilienceContextOptions(Action<IApizrResilienceContextOptionsBuilder>)
Set some options to the resilience context
TApizrOptionsBuilder WithResilienceContextOptions(Action<IApizrResilienceContextOptionsBuilder> contextOptionsBuilder)
Parameters
contextOptionsBuilder
Action<IApizrResilienceContextOptionsBuilder>The resilience context options builder
Returns
- TApizrOptionsBuilder
WithResilienceProperty<TValue>(ResiliencePropertyKey<TValue>, TValue)
Set some resilience properties to the resilience context
TApizrOptionsBuilder WithResilienceProperty<TValue>(ResiliencePropertyKey<TValue> key, TValue value)
Parameters
key
ResiliencePropertyKey<TValue>The resilience property's key
value
TValueThe resilience property's value
Returns
- TApizrOptionsBuilder
Type Parameters
TValue