Skip to main content
Table of Contents

Class EventRelevance

Namespace
Stratara.Abstractions.EventSourcing
Assembly
Stratara.Abstractions.dll

Which recorded events a reader has a use for, so the event mapper can leave every other event unread: not resolved against the trusted types and not decrypted.

public sealed class EventRelevance
Inheritance
EventRelevance
Inherited Members
Extension Methods

Remarks

A projection or a stateless saga is dispatched events by their exact type, so its host's relevance is ForTypes(IEnumerable<Type>) of the types its handlers take. An event whose type, after upcasting, resolves to one of them is mapped; one that resolves to another type is skipped. An event whose type does not resolve is skipped too — unless its name, without namespace or assembly, is the name of a relevant type, in which case it is mapped and fails as an unregistered type does, so a handled type moved without an upcaster is reported rather than lost.

A stateful saga process decides from the event itself whether it handles it, so its reader uses AnyResolvableWith(IEnumerable<Type>): every event whose type resolves is mapped, and one whose type does not is skipped — unless it carries the name of a type the process declares a handler for.

Properties

AnyResolvable

Every event whose type resolves is relevant; none whose type does not.

public static EventRelevance AnyResolvable { get; }

Property Value

EventRelevance

IsAnyResolvable

Whether this relevance takes every resolvable type rather than a set of them.

public bool IsAnyResolvable { get; }

Property Value

bool

Methods

AnyResolvableWith(IEnumerable<Type>)

Every event whose type resolves is relevant; one whose type does not is relevant only when it carries the name of one of declaredTypes, so that it fails as an unregistered type does.

public static EventRelevance AnyResolvableWith(IEnumerable<Type> declaredTypes)

Parameters

declaredTypes IEnumerable<Type>

The types a reader declares handlers for, beside deciding the rest at run time.

Returns

EventRelevance

The relevance.

Exceptions

ArgumentNullException

declaredTypes is null.

ArgumentException

declaredTypes contains null.

ForTypes(IEnumerable<Type>)

The events of exactly types are relevant.

public static EventRelevance ForTypes(IEnumerable<Type> types)

Parameters

types IEnumerable<Type>

The event payload types a reader's handlers take.

Returns

EventRelevance

The relevance of those types.

Exceptions

ArgumentNullException

types is null.

ArgumentException

types contains null.

Includes(Type)

Whether an event of eventType is relevant.

public bool Includes(Type eventType)

Parameters

eventType Type

The event's payload type, as resolved after upcasting.

Returns

bool

true when the event is to be mapped.

Exceptions

ArgumentNullException

eventType is null.

MayName(string)

Whether an event whose type does not resolve could still be a relevant one: its type name, without namespace or assembly, is the name of a relevant type.

public bool MayName(string typeName)

Parameters

typeName string

The simple type name, without namespace, declaring type or assembly.

Returns

bool

true when such an event is to be mapped, so it fails as an unregistered type does.

Exceptions

ArgumentNullException

typeName is null.