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
TUpgradeThe upgraded (newer generation) event type.
TPreviousThe previous (older generation) event type.
- Inheritance
-
EventTypeMigration<TUpgrade, TPrevious>
- Implements
-
IEventTypeMigrationFor<TUpgrade, TPrevious>IEventTypeMigrationFor<TUpgrade>
- 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 thanTPrevious's generation.
Properties
From
Gets the generation to migrate from.
public EventTypeGeneration From { get; }
Property Value
To
Gets the generation to migrate to.
public EventTypeGeneration To { get; }
Property Value
Methods
Downcast(IEventMigrationBuilder<TPrevious, TUpgrade>)
Define the type-safe downcast migration from TUpgrade to TPrevious.
public abstract void Downcast(IEventMigrationBuilder<TPrevious, TUpgrade> builder)
Parameters
builderIEventMigrationBuilder<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
builderIEventMigrationBuilder<TUpgrade, TPrevious>The IEventMigrationBuilder<TTarget, TSource> to use.