Table of Contents

Class EventTypeMigration<TUpgrade, TPrevious>

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

Abstract base class for type-safe event type migrations between two generations. Extracts From and To from the EventTypeAttribute on TUpgrade and TPrevious, and validates that the upgrade generation is exactly one more than the previous generation.

public abstract class EventTypeMigration<TUpgrade, TPrevious> : IEventTypeMigrationFor<TUpgrade, TPrevious>, IEventTypeMigrationFor<TUpgrade>, IEventTypeMigration

Type Parameters

TUpgrade

The upgraded (newer generation) event type.

TPrevious

The previous (older generation) event type.

Inheritance
EventTypeMigration<TUpgrade, TPrevious>
Implements
IEventTypeMigrationFor<TUpgrade, TPrevious>
Inherited Members

Constructors

EventTypeMigration()

Initializes a new instance of the EventTypeMigration<TUpgrade, TPrevious> class.

protected EventTypeMigration()

Exceptions

InvalidMigrationGenerationGap

Thrown when TUpgrade's generation is not exactly one more than TPrevious's generation.

Properties

From

Gets the generation to migrate from.

public EventTypeGeneration From { get; }

Property Value

EventTypeGeneration

To

Gets the generation to migrate to.

public EventTypeGeneration To { get; }

Property Value

EventTypeGeneration

Methods

Downcast(IEventMigrationBuilder<TPrevious, TUpgrade>)

Define the type-safe downcast migration from TUpgrade to TPrevious.

public abstract void Downcast(IEventMigrationBuilder<TPrevious, TUpgrade> builder)

Parameters

builder IEventMigrationBuilder<TPrevious, TUpgrade>

The IEventMigrationBuilder<TTarget, TSource> to use.

Upcast(IEventMigrationBuilder<TUpgrade, TPrevious>)

Define the type-safe upcast migration from TPrevious to TUpgrade.

public abstract void Upcast(IEventMigrationBuilder<TUpgrade, TPrevious> builder)

Parameters

builder IEventMigrationBuilder<TUpgrade, TPrevious>

The IEventMigrationBuilder<TTarget, TSource> to use.