Class ReadModelInterceptors

Namespace
Cratis.Arc.Queries
Assembly
Cratis.Arc.Core.dll

Represents an implementation of IReadModelInterceptors.

[Singleton]
public class ReadModelInterceptors : IReadModelInterceptors
Inheritance
ReadModelInterceptors
Implements
Inherited Members
Extension Methods

Remarks

Discovers all IInterceptReadModel<TReadModel> implementations via ITypes at startup. Interceptors can also be registered in the DI container as IInterceptReadModel<TReadModel> services.

Constructors

ReadModelInterceptors(ITypes)

Represents an implementation of IReadModelInterceptors.

public ReadModelInterceptors(ITypes types)

Parameters

types ITypes

ITypes used to discover interceptor implementations.

Remarks

Discovers all IInterceptReadModel<TReadModel> implementations via ITypes at startup. Interceptors can also be registered in the DI container as IInterceptReadModel<TReadModel> services.

Methods

Intercept(Type, IEnumerable<object>, IServiceProvider)

Applies all discovered interceptors for the given read model type to every item in the collection and returns the resulting (potentially replaced) items.

public Task<IEnumerable<object>> Intercept(Type readModelType, IEnumerable<object> items, IServiceProvider serviceProvider)

Parameters

readModelType Type

The type of the read model being intercepted.

items IEnumerable<object>

The read model items to intercept.

serviceProvider IServiceProvider

The IServiceProvider used to create interceptor instances and resolve their dependencies.

Returns

Task<IEnumerable<object>>

A Task<TResult> resolving to the intercepted items, which may be new instances.