Class ApizrCommonOptionsBuilder
- Namespace
- Apizr.Configuring.Common
- Assembly
- Apizr.dll
Builder options available at common level for static registrations
public class ApizrCommonOptionsBuilder : IApizrCommonOptionsBuilder, IApizrCommonOptionsBuilder<IApizrCommonOptions, IApizrCommonOptionsBuilder>, IApizrCommonOptionsBuilderBase<IApizrCommonOptions, IApizrCommonOptionsBuilder>, IApizrGlobalCommonOptionsBuilderBase<IApizrCommonOptions, IApizrCommonOptionsBuilder>, IApizrCommonOptionsBuilderBase, IApizrGlobalCommonOptionsBuilderBase, IApizrSharedRegistrationOptionsBuilder<IApizrCommonOptions, IApizrCommonOptionsBuilder>, IApizrSharedRegistrationOptionsBuilderBase<IApizrCommonOptions, IApizrCommonOptionsBuilder>, IApizrGlobalSharedRegistrationOptionsBuilderBase<IApizrCommonOptions, IApizrCommonOptionsBuilder>, IApizrGlobalSharedOptionsBuilderBase<IApizrCommonOptions, IApizrCommonOptionsBuilder>, IApizrSharedRegistrationOptionsBuilder, IApizrSharedRegistrationOptionsBuilderBase, IApizrGlobalSharedRegistrationOptionsBuilderBase, IApizrGlobalSharedOptionsBuilderBase
- Inheritance
-
ApizrCommonOptionsBuilder
- Implements
- Inherited Members
- Extension Methods
Fields
Options
The common options
protected readonly ApizrCommonOptions Options
Field Value
Methods
ConfigureHttpClient(Action<HttpClient>, ApizrDuplicateStrategy)
Configure HttpClient
public IApizrCommonOptionsBuilder ConfigureHttpClient(Action<HttpClient> configureHttpClient, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Merge)
Parameters
configureHttpClientAction<HttpClient>The configuration builder
strategyApizrDuplicateStrategyThe duplicate strategy if there's another one already (default: Merge)
Returns
WithAuthenticationHandler(Func<HttpRequestMessage, string, CancellationToken, Task<string>>)
Provide a method to refresh the authorization token when needed
public IApizrCommonOptionsBuilder WithAuthenticationHandler(Func<HttpRequestMessage, string, CancellationToken, Task<string>> refreshTokenFactory)
Parameters
refreshTokenFactoryFunc<HttpRequestMessage, string, CancellationToken, Task<string>>Refresh token method called when expired or empty
Returns
WithAuthenticationHandler(Func<HttpRequestMessage, CancellationToken, Task<string>>)
Provide methods to only get the authorization constant token when needed
public IApizrCommonOptionsBuilder WithAuthenticationHandler(Func<HttpRequestMessage, CancellationToken, Task<string>> getTokenFactory)
Parameters
getTokenFactoryFunc<HttpRequestMessage, CancellationToken, Task<string>>The method called to get local constant token
Returns
WithAuthenticationHandler(Func<HttpRequestMessage, CancellationToken, Task<string>>, Func<HttpRequestMessage, string, CancellationToken, Task>)
Provide methods to get and set the authorization token when needed
public IApizrCommonOptionsBuilder WithAuthenticationHandler(Func<HttpRequestMessage, CancellationToken, Task<string>> getTokenFactory, Func<HttpRequestMessage, string, CancellationToken, Task> setTokenFactory)
Parameters
getTokenFactoryFunc<HttpRequestMessage, CancellationToken, Task<string>>The method called to get local token
setTokenFactoryFunc<HttpRequestMessage, string, CancellationToken, Task>The method called to set local token
Returns
WithAuthenticationHandler(Func<HttpRequestMessage, CancellationToken, Task<string>>, Func<HttpRequestMessage, string, CancellationToken, Task>, Func<HttpRequestMessage, string, CancellationToken, Task<string>>)
Provide methods to get, set and refresh the authorization token when needed
public IApizrCommonOptionsBuilder WithAuthenticationHandler(Func<HttpRequestMessage, CancellationToken, Task<string>> getTokenFactory, Func<HttpRequestMessage, string, CancellationToken, Task> setTokenFactory, Func<HttpRequestMessage, string, CancellationToken, Task<string>> refreshTokenFactory)
Parameters
getTokenFactoryFunc<HttpRequestMessage, CancellationToken, Task<string>>The method called to get local token
setTokenFactoryFunc<HttpRequestMessage, string, CancellationToken, Task>The method called to get local token
refreshTokenFactoryFunc<HttpRequestMessage, string, CancellationToken, Task<string>>Refresh token method called when expired or empty
Returns
WithAuthenticationHandler<TAuthenticationHandler>(Func<IApizrManagerOptionsBase, TAuthenticationHandler>)
Provide your own AuthenticationHandlerBase implementation factory
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TAuthenticationHandler>(Func<IApizrManagerOptionsBase, TAuthenticationHandler> authenticationHandlerFactory) where TAuthenticationHandler : AuthenticationHandlerBase
Parameters
authenticationHandlerFactoryFunc<IApizrManagerOptionsBase, TAuthenticationHandler>A
TAuthenticationHandlerinstance factory
Returns
Type Parameters
TAuthenticationHandlerYour AuthenticationHandlerBase implementation
WithAuthenticationHandler<TTokenService>(Func<TTokenService>, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>)
Provide your own token management services
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TTokenService>(Func<TTokenService> tokenServiceFactory, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>> refreshTokenExpression)
Parameters
tokenServiceFactoryFunc<TTokenService>A
TTokenServiceinstance factoryrefreshTokenExpressionExpression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>The method called to refresh the token
Returns
Type Parameters
TTokenServiceYour token management service (refreshing token)
WithAuthenticationHandler<TSettingsService>(Func<TSettingsService>, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>)
Provide your own settings management service
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TSettingsService>(Func<TSettingsService> settingsServiceFactory, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>> getTokenExpression)
Parameters
settingsServiceFactoryFunc<TSettingsService>A
TSettingsServiceinstance factorygetTokenExpressionExpression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>The get only token expression
Returns
Type Parameters
TSettingsServiceYour settings management service (getting constant token)
WithAuthenticationHandler<TSettingsService>(Func<TSettingsService>, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>, Expression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>>)
Provide your own settings management service
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TSettingsService>(Func<TSettingsService> settingsServiceFactory, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>> getTokenExpression, Expression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>> setTokenExpression)
Parameters
settingsServiceFactoryFunc<TSettingsService>A
TSettingsServiceinstance factorygetTokenExpressionExpression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>The get token expression
setTokenExpressionExpression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>>The set token expression
Returns
Type Parameters
TSettingsServiceYour settings management service (saving/getting token)
WithAuthenticationHandler<TAuthService>(Func<TAuthService>, Expression<Func<TAuthService, HttpRequestMessage, CancellationToken, Task<string>>>, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task>>, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>>)
Provide your own auth management service
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TAuthService>(Func<TAuthService> authServiceFactory, Expression<Func<TAuthService, HttpRequestMessage, CancellationToken, Task<string>>> getTokenExpression, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task>> setTokenExpression, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>> refreshTokenExpression)
Parameters
authServiceFactoryFunc<TAuthService>A
TAuthServiceinstance factorygetTokenExpressionExpression<Func<TAuthService, HttpRequestMessage, CancellationToken, Task<string>>>The get token expression
setTokenExpressionExpression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task>>The set token expression
refreshTokenExpressionExpression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>>The method called to refresh the token
Returns
Type Parameters
TAuthServiceYour auth management service (saving/getting/refreshing token)
WithAuthenticationHandler<TSettingsService>(Func<TSettingsService>, Expression<Func<TSettingsService, string>>)
Provide your own settings management service with its token source
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TSettingsService>(Func<TSettingsService> settingsServiceFactory, Expression<Func<TSettingsService, string>> tokenPropertyExpression)
Parameters
settingsServiceFactoryFunc<TSettingsService>A
TSettingsServiceinstance factorytokenPropertyExpressionExpression<Func<TSettingsService, string>>The token property to get from and set to
Returns
Type Parameters
TSettingsServiceYour settings management service (getting token)
WithAuthenticationHandler<TAuthService>(Func<TAuthService>, Expression<Func<TAuthService, string>>, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>>)
Provide your own auth management service
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TAuthService>(Func<TAuthService> authServiceFactory, Expression<Func<TAuthService, string>> tokenPropertyExpression, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>> refreshTokenExpression)
Parameters
authServiceFactoryFunc<TAuthService>A
TAuthServiceinstance factorytokenPropertyExpressionExpression<Func<TAuthService, string>>The token property to get from and set to
refreshTokenExpressionExpression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>>
Returns
Type Parameters
TAuthServiceYour auth management service (saving/getting/refreshing token)
WithAuthenticationHandler<TTokenService>(TTokenService, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>)
Provide your own token management services
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TTokenService>(TTokenService tokenService, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>> refreshTokenExpression)
Parameters
tokenServiceTTokenServiceA
TTokenServiceinstancerefreshTokenExpressionExpression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>The method called to refresh the token
Returns
Type Parameters
TTokenServiceYour token management service (refreshing token)
WithAuthenticationHandler<TSettingsService>(TSettingsService, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>)
Provide your own settings management service
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TSettingsService>(TSettingsService settingsService, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>> getTokenExpression)
Parameters
settingsServiceTSettingsServiceA
TSettingsServiceinstancegetTokenExpressionExpression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>The get only token expression
Returns
Type Parameters
TSettingsServiceYour settings management service (getting constant token)
WithAuthenticationHandler<TSettingsService>(TSettingsService, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>, Expression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>>)
Provide your own settings management service
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TSettingsService>(TSettingsService settingsService, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>> getTokenExpression, Expression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>> setTokenExpression)
Parameters
settingsServiceTSettingsServiceA
TSettingsServiceinstancegetTokenExpressionExpression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>The get token expression
setTokenExpressionExpression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>>The set token expression
Returns
Type Parameters
TSettingsServiceYour settings management service (saving/getting token)
WithAuthenticationHandler<TAuthService>(TAuthService, Expression<Func<TAuthService, HttpRequestMessage, CancellationToken, Task<string>>>, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task>>, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>>)
Provide your own settings management and token management services
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TAuthService>(TAuthService authService, Expression<Func<TAuthService, HttpRequestMessage, CancellationToken, Task<string>>> getTokenExpression, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task>> setTokenExpression, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>> refreshTokenExpression)
Parameters
authServiceTAuthServiceA
TAuthServiceinstancegetTokenExpressionExpression<Func<TAuthService, HttpRequestMessage, CancellationToken, Task<string>>>The get token expression
setTokenExpressionExpression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task>>The set token expression
refreshTokenExpressionExpression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>>The method called to refresh the token
Returns
Type Parameters
TAuthServiceYour auth management service (saving/getting/refreshing token)
WithAuthenticationHandler<TSettingsService>(TSettingsService, Expression<Func<TSettingsService, string>>)
Provide your own settings management service with its token source
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TSettingsService>(TSettingsService settingsService, Expression<Func<TSettingsService, string>> tokenPropertyExpression)
Parameters
settingsServiceTSettingsServiceA
TSettingsServiceinstancetokenPropertyExpressionExpression<Func<TSettingsService, string>>The token property to get from and set to
Returns
Type Parameters
TSettingsServiceYour settings management service (getting token)
WithAuthenticationHandler<TAuthService>(TAuthService, Expression<Func<TAuthService, string>>, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>>)
Provide your own auth management service
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TAuthService>(TAuthService authService, Expression<Func<TAuthService, string>> tokenPropertyExpression, Expression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>> refreshTokenExpression)
Parameters
authServiceTAuthServiceA
TAuthServiceinstancetokenPropertyExpressionExpression<Func<TAuthService, string>>The token property to get from and set to
refreshTokenExpressionExpression<Func<TAuthService, HttpRequestMessage, string, CancellationToken, Task<string>>>
Returns
Type Parameters
TAuthServiceYour auth management service (saving/getting/refreshing token)
WithAuthenticationHandler<TSettingsService, TTokenService>(Func<TSettingsService>, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>, Expression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>>, Func<TTokenService>, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>)
Provide your own settings management and token management services
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TSettingsService, TTokenService>(Func<TSettingsService> settingsServiceFactory, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>> getTokenExpression, Expression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>> setTokenExpression, Func<TTokenService> tokenServiceFactory, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>> refreshTokenExpression)
Parameters
settingsServiceFactoryFunc<TSettingsService>A
TSettingsServiceinstance factorygetTokenExpressionExpression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>The get token expression
setTokenExpressionExpression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>>The set token expression
tokenServiceFactoryFunc<TTokenService>A
TTokenServiceinstance factoryrefreshTokenExpressionExpression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>The method called to refresh the token
Returns
Type Parameters
TSettingsServiceYour settings management service (saving/getting token)
TTokenServiceYour token management service (refreshing token)
WithAuthenticationHandler<TSettingsService, TTokenService>(Func<TSettingsService>, Expression<Func<TSettingsService, string>>, Func<TTokenService>, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>)
Provide your own settings management and token management services
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TSettingsService, TTokenService>(Func<TSettingsService> settingsServiceFactory, Expression<Func<TSettingsService, string>> tokenPropertyExpression, Func<TTokenService> tokenServiceFactory, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>> refreshTokenExpression)
Parameters
settingsServiceFactoryFunc<TSettingsService>A
TSettingsServiceinstance factorytokenPropertyExpressionExpression<Func<TSettingsService, string>>The token property to get from and set to
tokenServiceFactoryFunc<TTokenService>A
TTokenServiceinstance factoryrefreshTokenExpressionExpression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>
Returns
Type Parameters
TSettingsServiceYour settings management service (saving/getting token)
TTokenServiceYour token management service (refreshing token)
WithAuthenticationHandler<TSettingsService, TTokenService>(TSettingsService, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>, Expression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>>, TTokenService, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>)
Provide your own settings management and token management services
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TSettingsService, TTokenService>(TSettingsService settingsService, Expression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>> getTokenExpression, Expression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>> setTokenExpression, TTokenService tokenService, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>> refreshTokenExpression)
Parameters
settingsServiceTSettingsServiceA
TSettingsServiceinstancegetTokenExpressionExpression<Func<TSettingsService, HttpRequestMessage, CancellationToken, Task<string>>>The get token expression
setTokenExpressionExpression<Func<TSettingsService, HttpRequestMessage, string, CancellationToken, Task>>The set token expression
tokenServiceTTokenServiceA
TTokenServiceinstancerefreshTokenExpressionExpression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>The method called to refresh the token
Returns
Type Parameters
TSettingsServiceYour settings management service (saving/getting token)
TTokenServiceYour token management service (refreshing token)
WithAuthenticationHandler<TSettingsService, TTokenService>(TSettingsService, Expression<Func<TSettingsService, string>>, TTokenService, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>)
Provide your own settings management and token management services
public IApizrCommonOptionsBuilder WithAuthenticationHandler<TSettingsService, TTokenService>(TSettingsService settingsService, Expression<Func<TSettingsService, string>> tokenPropertyExpression, TTokenService tokenService, Expression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>> refreshTokenExpression)
Parameters
settingsServiceTSettingsServiceA
TSettingsServiceinstancetokenPropertyExpressionExpression<Func<TSettingsService, string>>The token property to get from and set to
tokenServiceTTokenServiceA
TTokenServiceinstancerefreshTokenExpressionExpression<Func<TTokenService, HttpRequestMessage, string, CancellationToken, Task<string>>>
Returns
Type Parameters
TSettingsServiceYour settings management service (saving/getting token)
TTokenServiceYour token management service (refreshing token)
WithBaseAddress(Func<string>, ApizrDuplicateStrategy)
Define your web api base address (could be defined with WebApiAttribute)
public IApizrCommonOptionsBuilder WithBaseAddress(Func<string> baseAddressFactory, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
baseAddressFactoryFunc<string>Your web api base address factory
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other already (default: Replace)
Returns
WithBaseAddress(Func<Uri>, ApizrDuplicateStrategy)
Define your web api base address (could be defined with WebApiAttribute)
public IApizrCommonOptionsBuilder WithBaseAddress(Func<Uri> baseAddressFactory, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
baseAddressFactoryFunc<Uri>Your web api base address factory
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other already (default: Replace)
Returns
WithBaseAddress(string, ApizrDuplicateStrategy)
Define your web api base address (could be defined with WebApiAttribute)
public IApizrCommonOptionsBuilder WithBaseAddress(string baseAddress, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
baseAddressstringYour web api base address
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other already (default: Replace)
Returns
WithBaseAddress(Uri, ApizrDuplicateStrategy)
Define your web api base address (could be defined with WebApiAttribute)
public IApizrCommonOptionsBuilder WithBaseAddress(Uri baseAddress, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
baseAddressUriYour web api base address
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other already (default: Replace)
Returns
WithBasePath(Func<string>, ApizrDuplicateStrategy)
Define your web api base path (could be defined with WebApiAttribute)
public IApizrCommonOptionsBuilder WithBasePath(Func<string> basePathFactory, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
basePathFactoryFunc<string>Your web api base path factory
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other already (default: Replace)
Returns
WithBasePath(string, ApizrDuplicateStrategy)
Define your web api base path (could be defined with WebApiAttribute)
public IApizrCommonOptionsBuilder WithBasePath(string basePath, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
basePathstringYour web api base path
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other already (default: Replace)
Returns
WithCacheHandler(ICacheHandler)
Provide a cache handler to cache data
public IApizrCommonOptionsBuilder WithCacheHandler(ICacheHandler cacheHandler)
Parameters
cacheHandlerICacheHandlerAn ICacheHandler mapping implementation instance
Returns
WithCacheHandler(Func<ICacheHandler>)
Provide a cache handler to cache data
public IApizrCommonOptionsBuilder WithCacheHandler(Func<ICacheHandler> cacheHandlerFactory)
Parameters
cacheHandlerFactoryFunc<ICacheHandler>An ICacheHandler mapping implementation instance factory
Returns
WithCaching(CacheMode, TimeSpan?, bool)
Cache data.
public IApizrCommonOptionsBuilder WithCaching(CacheMode mode = CacheMode.FetchOrGet, TimeSpan? lifeSpan = null, bool shouldInvalidateOnError = false)
Parameters
modeCacheModeFetchOrGet returns fresh data when request succeed otherwise cached one, where GetOrFetch returns cached data if we get some otherwise fresh one
lifeSpanTimeSpan?This specific caching lifetime (Default: null = cache handler lifetime
shouldInvalidateOnErrorboolShould invalidate on error (Default: false)
Returns
WithConfiguration(IConfiguration)
Set options from configuration
public IApizrCommonOptionsBuilder WithConfiguration(IConfiguration configuration)
Parameters
configurationIConfigurationThe configuration to set options from
Returns
WithConfiguration(IConfigurationSection)
Set options from a specific configuration section
public IApizrCommonOptionsBuilder WithConfiguration(IConfigurationSection configurationSection)
Parameters
configurationSectionIConfigurationSectionThe configuration section to set options from
Returns
WithConnectivityHandler(IConnectivityHandler)
Provide a connectivity handler to check connectivity before sending a request
public IApizrCommonOptionsBuilder WithConnectivityHandler(IConnectivityHandler connectivityHandler)
Parameters
connectivityHandlerIConnectivityHandlerAn IConnectivityHandler mapping implementation instance
Returns
WithConnectivityHandler(Func<IConnectivityHandler>)
Provide a connectivity handler
public IApizrCommonOptionsBuilder WithConnectivityHandler(Func<IConnectivityHandler> connectivityHandlerFactory)
Parameters
connectivityHandlerFactoryFunc<IConnectivityHandler>An IConnectivityHandler mapping implementation instance factory
Returns
WithConnectivityHandler(Func<bool>)
Provide a function to invoke while checking connectivity
public IApizrCommonOptionsBuilder WithConnectivityHandler(Func<bool> connectivityCheckingFunction)
Parameters
Returns
WithDelegatingHandler<THandler>(Func<IApizrManagerOptionsBase, THandler>, ApizrDuplicateStrategy)
Add a custom delegating handler inheriting from DelegatingHandler (serial call)
public IApizrCommonOptionsBuilder WithDelegatingHandler<THandler>(Func<IApizrManagerOptionsBase, THandler> delegatingHandlerFactory, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Add) where THandler : DelegatingHandler
Parameters
delegatingHandlerFactoryFunc<IApizrManagerOptionsBase, THandler>A delegating handler factory
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other already (default: Add)
Returns
Type Parameters
THandler
WithDelegatingHandler<THandler>(THandler, ApizrDuplicateStrategy)
Add a custom delegating handler inheriting from DelegatingHandler (serial call)
public IApizrCommonOptionsBuilder WithDelegatingHandler<THandler>(THandler delegatingHandler, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Add) where THandler : DelegatingHandler
Parameters
delegatingHandlerTHandlerA delegating handler
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other already (default: Add)
Returns
Type Parameters
THandler
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")]
public IApizrCommonOptionsBuilder WithExCatching(Action<ApizrException> onException, bool letThrowOnException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onExceptionAction<ApizrException>The exception callback
letThrowOnExceptionboolLet throw potential exception (default: true)
strategyApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
WithExCatching(Func<ApizrException, bool>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
public IApizrCommonOptionsBuilder WithExCatching(Func<ApizrException, bool> onException, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onExceptionFunc<ApizrException, bool>The exception callback returning handled boolean flag
letThrowOnHandledExceptionboolLet throw potential exception even if it's handled (default: true)
strategyApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
WithExCatching(Func<ApizrException, Task<bool>>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
public IApizrCommonOptionsBuilder WithExCatching(Func<ApizrException, Task<bool>> onException, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onExceptionFunc<ApizrException, Task<bool>>The exception callback returning handled boolean flag Task
letThrowOnHandledExceptionboolLet throw potential exception even if it's handled (default: true)
strategyApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
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")]
public IApizrCommonOptionsBuilder WithExCatching<TResult>(Action<ApizrException<TResult>> onException, bool letThrowOnException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onExceptionAction<ApizrException<TResult>>The exception callback
letThrowOnExceptionboolLet throw potential exception (default: true)
strategyApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
Type Parameters
TResult
WithExCatching<TResult>(Func<ApizrException<TResult>, bool>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
public IApizrCommonOptionsBuilder WithExCatching<TResult>(Func<ApizrException<TResult>, bool> onException, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onExceptionFunc<ApizrException<TResult>, bool>The exception callback returning handled boolean flag
letThrowOnHandledExceptionboolLet throw potential exception even if it's handled (default: true)
strategyApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
Type Parameters
TResult
WithExCatching<TResult>(Func<ApizrException<TResult>, Task<bool>>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
public IApizrCommonOptionsBuilder WithExCatching<TResult>(Func<ApizrException<TResult>, Task<bool>> onException, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace)
Parameters
onExceptionFunc<ApizrException<TResult>, Task<bool>>The exception callback returning a handled boolean flag Task
letThrowOnHandledExceptionboolLet throw potential exception even if it's handled (default: true)
strategyApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
Type Parameters
TResult
WithExCatching<THandler>(Func<THandler>, bool, ApizrDuplicateStrategy)
Catch potential exceptions
public IApizrCommonOptionsBuilder WithExCatching<THandler>(Func<THandler> exceptionHandlerFactory, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace) where THandler : IApizrExceptionHandler
Parameters
exceptionHandlerFactoryFunc<THandler>The exception handler called back and returning handled boolean flag Task
letThrowOnHandledExceptionboolLet throw potential exception even if it's handled (default: true)
strategyApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
Type Parameters
THandler
WithExCatching<THandler>(THandler, bool, ApizrDuplicateStrategy)
Catch potential exceptions
public IApizrCommonOptionsBuilder WithExCatching<THandler>(THandler exceptionHandler, bool letThrowOnHandledException = true, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Replace) where THandler : IApizrExceptionHandler
Parameters
exceptionHandlerTHandlerThe exception handler called back and returning handled boolean flag Task
letThrowOnHandledExceptionboolLet throw potential exception even if it's handled (default: true)
strategyApizrDuplicateStrategyThe duplicate strategy if there's another callback already (default: Replace)
Returns
Type Parameters
THandler
WithHandlerParameter(string, object)
Set some parameters passed through all delegating handlers
public IApizrCommonOptionsBuilder WithHandlerParameter(string key, object value)
Parameters
Returns
WithHeaders(IList<string>, ApizrDuplicateStrategy, ApizrRegistrationMode)
Add some headers to the request
public IApizrCommonOptionsBuilder WithHeaders(IList<string> headers, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Add, ApizrRegistrationMode mode = ApizrRegistrationMode.Set)
Parameters
headersIList<string>Headers to add to the request
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other already (default: Add)
modeApizrRegistrationModeSet headers right the way or store it for further attribute key match use (default: Set)
Returns
WithHeaders(Func<IList<string>>, ApizrDuplicateStrategy, ApizrLifetimeScope, ApizrRegistrationMode)
Add some headers to the request
public IApizrCommonOptionsBuilder WithHeaders(Func<IList<string>> headersFactory, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Add, ApizrLifetimeScope scope = ApizrLifetimeScope.Api, ApizrRegistrationMode mode = ApizrRegistrationMode.Set)
Parameters
headersFactoryFunc<IList<string>>Headers factory
strategyApizrDuplicateStrategyThe duplicate strategy if there's another one already (default: Add)
scopeApizrLifetimeScopeTells Apizr if you want to refresh or not headers values at request time (default: Api = no refresh)
modeApizrRegistrationModeSet headers right the way or store it for further attribute key match use (default: Set)
Returns
WithHeaders<TSettingsService>(Func<TSettingsService>, Expression<Func<TSettingsService, string>>[], ApizrDuplicateStrategy, ApizrLifetimeScope, ApizrRegistrationMode)
Add some headers to the request loaded from service properties
public IApizrCommonOptionsBuilder WithHeaders<TSettingsService>(Func<TSettingsService> settingsServiceFactory, Expression<Func<TSettingsService, string>>[] headerProperties, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Add, ApizrLifetimeScope scope = ApizrLifetimeScope.Api, ApizrRegistrationMode mode = ApizrRegistrationMode.Set)
Parameters
settingsServiceFactoryFunc<TSettingsService>A
TSettingsServiceinstance factoryheaderPropertiesExpression<Func<TSettingsService, string>>[]The header properties to get from
strategyApizrDuplicateStrategyThe duplicate strategy if there's another one already (default: Add)
scopeApizrLifetimeScopeTells Apizr if you want to refresh or not headers values at request time (default: Api = no refresh)
modeApizrRegistrationModeSet headers right the way or store it for further attribute key match use (default: Set)
Returns
Type Parameters
TSettingsServiceYour settings management service (getting headers)
WithHeaders<TSettingsService>(TSettingsService, Expression<Func<TSettingsService, string>>[], ApizrDuplicateStrategy, ApizrLifetimeScope, ApizrRegistrationMode)
Add some headers to the request loaded from service properties
public IApizrCommonOptionsBuilder WithHeaders<TSettingsService>(TSettingsService settingsService, Expression<Func<TSettingsService, string>>[] headerProperties, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Add, ApizrLifetimeScope scope = ApizrLifetimeScope.Api, ApizrRegistrationMode mode = ApizrRegistrationMode.Set)
Parameters
settingsServiceTSettingsServiceA
TSettingsServiceinstanceheaderPropertiesExpression<Func<TSettingsService, string>>[]The header properties to get from
strategyApizrDuplicateStrategyThe duplicate strategy if there's another one already (default: Add)
scopeApizrLifetimeScopeTells Apizr if you want to refresh or not headers values at request time (default: Api = no refresh)
modeApizrRegistrationModeSet headers right the way or store it for further attribute key match use (default: Set)
Returns
Type Parameters
TSettingsServiceYour settings management service (getting headers)
WithHttpClientHandler(Func<HttpClientHandler>)
Provide a custom HttpClientHandler
public IApizrCommonOptionsBuilder WithHttpClientHandler(Func<HttpClientHandler> httpClientHandlerFactory)
Parameters
httpClientHandlerFactoryFunc<HttpClientHandler>An HttpClientHandler instance factory
Returns
WithHttpClientHandler(HttpClientHandler)
Provide a custom HttpClientHandler
public IApizrCommonOptionsBuilder WithHttpClientHandler(HttpClientHandler httpClientHandler)
Parameters
httpClientHandlerHttpClientHandlerAn HttpClientHandler instance
Returns
WithHttpMessageHandler<THandler>(Func<IApizrManagerOptionsBase, THandler>)
Add a custom http message handler inheriting from HttpMessageHandler (last call)
public IApizrCommonOptionsBuilder WithHttpMessageHandler<THandler>(Func<IApizrManagerOptionsBase, THandler> httpMessageHandlerFactory) where THandler : HttpMessageHandler
Parameters
httpMessageHandlerFactoryFunc<IApizrManagerOptionsBase, THandler>A http message handler factory
Returns
Type Parameters
THandler
WithHttpMessageHandler<THandler>(THandler)
Add a custom http message handler inheriting from HttpMessageHandler (last call)
public IApizrCommonOptionsBuilder WithHttpMessageHandler<THandler>(THandler httpMessageHandler) where THandler : HttpMessageHandler
Parameters
httpMessageHandlerTHandlerA http message handler
Returns
Type Parameters
THandler
WithLoggedHeadersRedactionNames(IEnumerable<string>, ApizrDuplicateStrategy)
Sets the collection of HTTP headers names for which values should be redacted before logging.
public IApizrCommonOptionsBuilder WithLoggedHeadersRedactionNames(IEnumerable<string> redactedLoggedHeaderNames, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Add)
Parameters
redactedLoggedHeaderNamesIEnumerable<string>The collection of HTTP headers names for which values should be redacted before logging.
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other names already (default: Add)
Returns
WithLoggedHeadersRedactionRule(Func<string, bool>, ApizrDuplicateStrategy)
Sets the Func<T, TResult> which determines whether to redact the HTTP header value before logging.
public IApizrCommonOptionsBuilder WithLoggedHeadersRedactionRule(Func<string, bool> shouldRedactHeaderValue, ApizrDuplicateStrategy strategy = ApizrDuplicateStrategy.Add)
Parameters
shouldRedactHeaderValueFunc<string, bool>The Func<T, TResult> which determines whether to redact the HTTP header value before logging
strategyApizrDuplicateStrategyThe duplicate strategy if there's any other names already (default: Add)
Returns
WithLoggerFactory(ILoggerFactory)
Provide a logger factory
public IApizrCommonOptionsBuilder WithLoggerFactory(ILoggerFactory loggerFactory)
Parameters
loggerFactoryILoggerFactoryThe logger factory
Returns
WithLoggerFactory(Func<ILoggerFactory>)
Provide a logger factory
public IApizrCommonOptionsBuilder WithLoggerFactory(Func<ILoggerFactory> loggerFactory)
Parameters
loggerFactoryFunc<ILoggerFactory>The logger factory
Returns
WithLogging(HttpTracerMode, HttpMessageParts, params LogLevel[])
Define tracer mode, http traffic tracing verbosity and log levels (could be defined with LogAttribute)
public IApizrCommonOptionsBuilder WithLogging(HttpTracerMode httpTracerMode = HttpTracerMode.Everything, HttpMessageParts trafficVerbosity = HttpMessageParts.All, params LogLevel[] logLevels)
Parameters
httpTracerModeHttpTracerModetrafficVerbosityHttpMessagePartsHttp traffic tracing verbosity (default: All)
logLevelsLogLevel[]Log levels to apply while writing (default: Information)
Returns
WithLogging(Func<HttpTracerMode>, Func<HttpMessageParts>, Func<LogLevel[]>)
Define tracer mode, http traffic tracing verbosity and log levels (could be defined with LogAttribute)
public IApizrCommonOptionsBuilder WithLogging(Func<HttpTracerMode> httpTracerModeFactory, Func<HttpMessageParts> trafficVerbosityFactory, Func<LogLevel[]> logLevelsFactory)
Parameters
httpTracerModeFactoryFunc<HttpTracerMode>Http traffic tracing mode
trafficVerbosityFactoryFunc<HttpMessageParts>Http traffic tracing verbosity factory
logLevelsFactoryFunc<LogLevel[]>Log levels factory
Returns
WithLogging(Func<(HttpTracerMode, HttpMessageParts, LogLevel[])>)
Define tracer mode, http traffic tracing verbosity and log levels (could be defined with LogAttribute)
public IApizrCommonOptionsBuilder WithLogging(Func<(HttpTracerMode, HttpMessageParts, LogLevel[])> loggingConfigurationFactory)
Parameters
loggingConfigurationFactoryFunc<(HttpTracerMode, HttpMessageParts, LogLevel[])>Logging configuration factory
Returns
WithMappingHandler(IMappingHandler)
Provide a mapping handler to map entities
public IApizrCommonOptionsBuilder WithMappingHandler(IMappingHandler mappingHandler)
Parameters
mappingHandlerIMappingHandlerAn IMappingHandler mapping implementation instance
Returns
WithMappingHandler(Func<IMappingHandler>)
Provide a mapping handler to map entities
public IApizrCommonOptionsBuilder WithMappingHandler(Func<IMappingHandler> mappingHandlerFactory)
Parameters
mappingHandlerFactoryFunc<IMappingHandler>An IMappingHandler mapping implementation instance factory
Returns
WithOperationTimeout(Func<TimeSpan>)
Set a timeout to the operation (overall request tries)
public IApizrCommonOptionsBuilder WithOperationTimeout(Func<TimeSpan> timeoutFactory)
Parameters
Returns
WithOperationTimeout(TimeSpan)
Set a timeout to the operation (overall request tries)
public IApizrCommonOptionsBuilder WithOperationTimeout(TimeSpan timeout)
Parameters
timeoutTimeSpanThe operation timeout
Returns
WithRefitSettings(RefitSettings)
Provide some Refit specific settings
public IApizrCommonOptionsBuilder WithRefitSettings(RefitSettings refitSettings)
Parameters
refitSettingsRefitSettingsA Refit.RefitSettings instance
Returns
WithRefitSettings(Func<RefitSettings>)
Provide some Refit specific settings
public IApizrCommonOptionsBuilder WithRefitSettings(Func<RefitSettings> refitSettingsFactory)
Parameters
refitSettingsFactoryFunc<RefitSettings>A Refit.RefitSettings instance factory
Returns
WithRequestTimeout(Func<TimeSpan>)
Set a timeout to the request (each request try)
public IApizrCommonOptionsBuilder WithRequestTimeout(Func<TimeSpan> timeoutFactory)
Parameters
Returns
WithRequestTimeout(TimeSpan)
Set a timeout to the request (each request try)
public IApizrCommonOptionsBuilder WithRequestTimeout(TimeSpan timeout)
Parameters
timeoutTimeSpanThe request timeout
Returns
WithResilienceContextOptions(Action<IApizrResilienceContextOptionsBuilder>)
Set some options to the resilience context
public IApizrCommonOptionsBuilder WithResilienceContextOptions(Action<IApizrResilienceContextOptionsBuilder> contextOptionsBuilder)
Parameters
contextOptionsBuilderAction<IApizrResilienceContextOptionsBuilder>The resilience context options builder
Returns
WithResiliencePipelineKeys(string[], IEnumerable<ApizrRequestMethod>, ApizrDuplicateStrategy)
Apply some resilience strategies by getting pipelines from registry with key matching.
public IApizrCommonOptionsBuilder WithResiliencePipelineKeys(string[] resiliencePipelineKeys, IEnumerable<ApizrRequestMethod> methodScope = null, ApizrDuplicateStrategy duplicateStrategy = ApizrDuplicateStrategy.Add)
Parameters
resiliencePipelineKeysstring[]Resilience pipeline keys from the registry.
methodScopeIEnumerable<ApizrRequestMethod>Http or Crud methods to apply pipelines on (default: null = All)
duplicateStrategyApizrDuplicateStrategyThe duplicate strategy if there's any other names already (default: Add)
Returns
WithResiliencePipelineRegistry(ResiliencePipelineRegistry<string>)
Provide a resilience pipeline registry
public IApizrCommonOptionsBuilder WithResiliencePipelineRegistry(ResiliencePipelineRegistry<string> resiliencePipelineRegistry)
Parameters
resiliencePipelineRegistryResiliencePipelineRegistry<string>A resilience pipeline registry instance
Returns
WithResiliencePipelineRegistry(Func<ResiliencePipelineRegistry<string>>)
Provide a resilience pipeline registry
public IApizrCommonOptionsBuilder WithResiliencePipelineRegistry(Func<ResiliencePipelineRegistry<string>> resiliencePipelineRegistryFactory)
Parameters
resiliencePipelineRegistryFactoryFunc<ResiliencePipelineRegistry<string>>A resilience pipeline registry instance factory
Returns
WithResilienceProperty<TValue>(ResiliencePropertyKey<TValue>, Func<TValue>)
Set some resilience properties to the resilience context
public IApizrCommonOptionsBuilder WithResilienceProperty<TValue>(ResiliencePropertyKey<TValue> key, Func<TValue> valueFactory)
Parameters
keyResiliencePropertyKey<TValue>The resilience property's key
valueFactoryFunc<TValue>The resilience property's value factory
Returns
Type Parameters
TValue
WithResilienceProperty<TValue>(ResiliencePropertyKey<TValue>, TValue)
Set some resilience properties to the resilience context
public IApizrCommonOptionsBuilder WithResilienceProperty<TValue>(ResiliencePropertyKey<TValue> key, TValue value)
Parameters
keyResiliencePropertyKey<TValue>The resilience property's key
valueTValueThe resilience property's value
Returns
Type Parameters
TValue