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
TUpgradeThe upgraded (newer generation) event type.
TPreviousThe 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
upgradePropertyExpression<Func<TUpgrade, TUpgradeProperty>>Expression selecting the property on the upgraded generation.
previousPropertyExpression<Func<TPrevious, TPreviousProperty>>Expression selecting the property on the previous generation.
mapAction<IValueMapBuilder<TPreviousProperty, TUpgradeProperty>>Action declaring which value becomes which.
Returns
- IEventValueMapBuilder<TUpgrade, TPrevious>
The builder for continued configuration.
Type Parameters
TUpgradePropertyThe type of the property on the upgraded generation.
TPreviousPropertyThe 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.