Class TenantFilterBehaviorBase<TKey, TEntityModel, TRequest, TResponse>
- Namespace
- Arbiter.CommandQuery.Behaviors
- Assembly
- Arbiter.CommandQuery.dll
A behavior for appending tenant filter to a query.
public abstract class TenantFilterBehaviorBase<TKey, TEntityModel, TRequest, TResponse> : PipelineBehaviorBase<TRequest, TResponse>, IPipelineBehavior<TRequest, TResponse> where TEntityModel : class where TRequest : class, IRequest<TResponse>
Type Parameters
TKey
The type of the model key
TEntityModel
The type of the model
TRequest
The type of the request
TResponse
The type of the response
- Inheritance
-
PipelineBehaviorBase<TRequest, TResponse>TenantFilterBehaviorBase<TKey, TEntityModel, TRequest, TResponse>
- Implements
-
IPipelineBehavior<TRequest, TResponse>
- Derived
- Inherited Members
Constructors
TenantFilterBehaviorBase(ILoggerFactory, ITenantResolver<TKey>)
Initializes a new instance of the TenantFilterBehaviorBase<TKey, TEntityModel, TRequest, TResponse> class.
protected TenantFilterBehaviorBase(ILoggerFactory loggerFactory, ITenantResolver<TKey> tenantResolver)
Parameters
loggerFactory
ILoggerFactoryThe logger factory to create an ILogger from
tenantResolver
ITenantResolver<TKey>The tenant resolver service.
Exceptions
Properties
TenantResolver
Gets the tenant resolver service.
protected ITenantResolver<TKey> TenantResolver { get; }
Property Value
- ITenantResolver<TKey>
Methods
RewriteFilter(EntityFilter?, ClaimsPrincipal?)
Rewrites the filter to include the tenant filter.
protected virtual ValueTask<EntityFilter?> RewriteFilter(EntityFilter? originalFilter, ClaimsPrincipal? principal)
Parameters
originalFilter
EntityFilterThe original filter to add the tenant filter to
principal
ClaimsPrincipalThe claims principal for this behavior.
Returns
- ValueTask<EntityFilter>
An EntityFilter with tenant filter added
Exceptions
- DomainException
When failed find a tenant for the request