Table of Contents

Class ReducerTypeExtensions

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

Extension methods for working with reducer types.

public static class ReducerTypeExtensions
Inheritance
ReducerTypeExtensions
Inherited Members

Methods

GetEventSequenceId(Type)

Get the event sequence id for a reducer type.

public static EventSequenceId GetEventSequenceId(this Type type)

Parameters

type Type

Type to get from.

Returns

EventSequenceId

The EventSequenceId for the type.

GetReadModelType(Type)

Get the type of the read model for a reducer.

public static Type GetReadModelType(this Type type)

Parameters

type Type

Reducer type to get for.

Returns

Type

Type of read model.

GetReducerId(Type)

Get the reducer id for a type.

public static ReducerId GetReducerId(this Type type)

Parameters

type Type

Type to get from.

Returns

ReducerId

The ReducerId for the type.

IsActive(Type)

Get whether a reducer is active.

public static bool IsActive(this Type type)

Parameters

type Type

Type to get from.

Returns

bool

True if it is, false if not.

IsReducerMethod(MethodInfo, Type, IEnumerable<Type>)

Check if a MethodInfo is a reducer method.

public static bool IsReducerMethod(this MethodInfo methodInfo, Type readModelType, IEnumerable<Type> eventTypes)

Parameters

methodInfo MethodInfo

MethodInfo to check.

readModelType Type

Type of read model.

eventTypes IEnumerable<Type>

Known event types in the process.

Returns

bool

True if it is a reducer method, false if not.

Remarks

The following are considered valid reducer method signatures.

Task<TReadModel> {MethodName}(TEvent event, TReadModel? initial, EventContext context) Task<TReadModel> {MethodName}(TEvent event, TReadModel? initial) TReadModel {MethodName}(TEvent event, TReadModel? current, EventContext context) TReadModel {MethodName}(TEvent event, TReadModel? current)