Table of Contents

Class EventUpgrader<TFrom, TTo>

Namespace
Excalibur.EventSourcing.Upcasting
Assembly
Excalibur.EventSourcing.dll

Base implementation of IEventUpgrader for typed events.

public abstract class EventUpgrader<TFrom, TTo> : IEventUpgrader where TFrom : class where TTo : class

Type Parameters

TFrom

The source event type.

TTo

The target event type.

Inheritance
EventUpgrader<TFrom, TTo>
Implements
Inherited Members

Remarks

Provides a type-safe base class for implementing event upgraders. Derived classes only need to implement the UpgradeEvent(TFrom) method with strongly-typed parameters.

Properties

EventType

Gets the event type this upgrader handles.

public abstract string EventType { get; }

Property Value

string

The event type this upgrader handles.

FromVersion

Gets the source version this upgrader upgrades from.

public abstract int FromVersion { get; }

Property Value

int

The source version this upgrader upgrades from.

ToVersion

Gets the target version this upgrader upgrades to.

public abstract int ToVersion { get; }

Property Value

int

The target version this upgrader upgrades to.

Methods

CanUpgrade(string, int)

Determines whether this upgrader can upgrade the specified event.

public bool CanUpgrade(string eventType, int fromVersion)

Parameters

eventType string

The type of the event.

fromVersion int

The version to upgrade from.

Returns

bool

True if this upgrader can handle the upgrade, otherwise false.

Upgrade(object)

Upgrades an event from an older version to a newer version.

public object Upgrade(object oldEvent)

Parameters

oldEvent object

The old event data.

Returns

object

The upgraded event.

UpgradeEvent(TFrom)

Upgrades a typed event from the old version to the new version.

protected abstract TTo UpgradeEvent(TFrom oldEvent)

Parameters

oldEvent TFrom

The old event.

Returns

TTo

The upgraded event.