Table of Contents

Class ReducerInvoker

Namespace
Cratis.Chronicle.Reducers
Assembly
Cratis.Chronicle.dll

Represents an implementation of IReducerInvoker.

public class ReducerInvoker : IReducerInvoker
Inheritance
ReducerInvoker
Implements
Inherited Members

Constructors

ReducerInvoker(IEventTypes, IClientArtifactsActivator, Type, Type, ReadModelContainerName)

Initializes a new instance of the ReducerInvoker class.

public ReducerInvoker(IEventTypes eventTypes, IClientArtifactsActivator artifactActivator, Type targetType, Type readModelType, ReadModelContainerName containerName)

Parameters

eventTypes IEventTypes

IEventTypes for mapping types.

artifactActivator IClientArtifactsActivator

IClientArtifactsActivator for creating reducer instances.

targetType Type

Type of reducer.

readModelType Type

Type of read model for the reducer.

containerName ReadModelContainerName

Container name of the read model for the reducer.

Properties

ContainerName

Gets the container name of the read model (collection, table, etc.).

public ReadModelContainerName ContainerName { get; }

Property Value

ReadModelContainerName

EventTypes

Gets the event types the reducer is for.

public IImmutableList<EventType> EventTypes { get; }

Property Value

IImmutableList<EventType>

ReadModelType

Gets the type of the read model.

public Type ReadModelType { get; }

Property Value

Type

Methods

Invoke(IServiceProvider, IEnumerable<EventAndContext>, object?)

Invoke the reducer for a set of events.

public Task<ReduceResult> Invoke(IServiceProvider serviceProvider, IEnumerable<EventAndContext> eventsAndContexts, object? initialReadModelContent)

Parameters

serviceProvider IServiceProvider

The IServiceProvider for creating the actual instance of the reducer.

eventsAndContexts IEnumerable<EventAndContext>

The events to reduce from.

initialReadModelContent object

The initial state of the read model, can be null.

Returns

Task<ReduceResult>

The reduced read model.

Remarks

This is to be used for events that all have a key the same as the read model.