Table of Contents

Interface IEventUpgrader

Namespace
Excalibur.EventSourcing
Assembly
Excalibur.EventSourcing.Abstractions.dll

Defines a contract for upgrading events from older versions to newer versions.

public interface IEventUpgrader

Remarks

Event upgraders are used in event sourcing systems to handle schema evolution. When an event's schema changes between versions, upgraders transform old event formats to the current version during aggregate hydration.

Properties

EventType

Gets the event type this upgrader handles.

string EventType { get; }

Property Value

string

The event type this upgrader handles.

FromVersion

Gets the source version this upgrader upgrades from.

int FromVersion { get; }

Property Value

int

The source version this upgrader upgrades from.

ToVersion

Gets the target version this upgrader upgrades to.

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.

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.

object Upgrade(object oldEvent)

Parameters

oldEvent object

The old event data.

Returns

object

The upgraded event.