Table of Contents

Class EventTypeExtensions

Namespace
Cratis.Chronicle.Events
Assembly
Cratis.Chronicle.dll

Extension methods for working with EventType and Type .

public static class EventTypeExtensions
Inheritance
EventTypeExtensions
Inherited Members

Methods

GetEventStoreName(Type)

Get the event store name for an event type.

public static string? GetEventStoreName(this Type type)

Parameters

type Type

Type to get for.

Returns

string

The event store name, or null if neither the type nor its assembly has the attribute.

Remarks

First checks for a type-level EventStoreAttribute. If not found, falls back to an assembly-level EventStoreAttribute on the type's declaring assembly.

GetEventType(Type)

Get the EventType for a CLR type.

public static EventType GetEventType(this Type type)

Parameters

type Type

Type to get for.

Returns

EventType

The EventType.

Exceptions

TypeIsNotAnEventType

Thrown if the type is not an event type.

GetEventTypes(Type, IEnumerable<Type>)

Get the event types for a type.

public static IEnumerable<Type> GetEventTypes(this Type type, IEnumerable<Type> eventTypes)

Parameters

type Type

The CLR type to get for.

eventTypes IEnumerable<Type>

Known event types in the process.

Returns

IEnumerable<Type>

Collection of actual event types.

IsEventType(Type, IEnumerable<Type>)

Check if a type is an event type.

public static bool IsEventType(this Type type, IEnumerable<Type> eventTypes)

Parameters

type Type

Type to check.

eventTypes IEnumerable<Type>

Known event types in the process.

Returns

bool

True if it is an event type, false if not.

ValidateEventType(Type)

Validate if a type is an event type.

public static void ValidateEventType(this Type type)

Parameters

type Type

Type to validate.

Exceptions

TypeIsNotAnEventType

Thrown if the type is not an event type.