Interface IEventValueMapBuilder<TUpgrade, TPrevious>

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

Defines a builder for the value maps of an event type migration - the values that keep their property but change what they mean between two generations.

public interface IEventValueMapBuilder<TUpgrade, TPrevious>

Type Parameters

TUpgrade

The upgraded (newer generation) event type.

TPrevious

The previous (older generation) event type.

Extension Methods

Remarks

A map declared here is stated once and applied in both directions: forward when upcasting, inverted when downcasting. That is the whole point of declaring it as a map rather than as two transformations - the pair of values is one fact about the two generations, and stating it twice is how the two directions drift apart. A direction that states its own transformation for the same property keeps it.

Methods

For<TUpgradeProperty, TPreviousProperty>(Expression<Func<TUpgrade, TUpgradeProperty>>, Expression<Func<TPrevious, TPreviousProperty>>, Action<IValueMapBuilder<TPreviousProperty, TUpgradeProperty>>)

Declare the value map for a property, from how the previous generation expressed it to how the upgraded generation does.

IEventValueMapBuilder<TUpgrade, TPrevious> For<TUpgradeProperty, TPreviousProperty>(Expression<Func<TUpgrade, TUpgradeProperty>> upgradeProperty, Expression<Func<TPrevious, TPreviousProperty>> previousProperty, Action<IValueMapBuilder<TPreviousProperty, TUpgradeProperty>> map)

Parameters

upgradeProperty Expression<Func<TUpgrade, TUpgradeProperty>>

Expression selecting the property on the upgraded generation.

previousProperty Expression<Func<TPrevious, TPreviousProperty>>

Expression selecting the property on the previous generation.

map Action<IValueMapBuilder<TPreviousProperty, TUpgradeProperty>>

Action declaring which value becomes which.

Returns

IEventValueMapBuilder<TUpgrade, TPrevious>

The builder for continued configuration.

Type Parameters

TUpgradeProperty

The type of the property on the upgraded generation.

TPreviousProperty

The type of the property on the previous generation.

Remarks

The two properties do not have to share a name - the map carries the value across from one to the other, so it also covers a rename of the property it maps.