Interface IEventMigrationPropertyBuilder<TTarget, TSource>

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

Defines a type-safe builder for event migration property transformations using expressions.

public interface IEventMigrationPropertyBuilder<TTarget, TSource>

Type Parameters

TTarget

The target event type of the migration.

TSource

The source event type of the migration.

Extension Methods

Remarks

Chronicle resolves each accessed member using its JsonPropertyNameAttribute when present, otherwise the client's JSON naming policy. The resolved paths reach the raw builder without further name conversion. Expressions describe member paths; they are not executed as transformations.

Methods

Combine<TProperty>(Expression<Func<TTarget, TProperty>>, PropertySeparator, params Expression<Func<TSource, object>>[])

Combine multiple source properties into a single target property by concatenation.

IEventMigrationPropertyBuilder<TTarget, TSource> Combine<TProperty>(Expression<Func<TTarget, TProperty>> targetProperty, PropertySeparator separator, params Expression<Func<TSource, object>>[] sourceProperties)

Parameters

targetProperty Expression<Func<TTarget, TProperty>>

Expression selecting the target property to write the combined result into.

separator PropertySeparator

The separator to use between the combined values.

sourceProperties Expression<Func<TSource, object>>[]

Expressions selecting the source properties to concatenate.

Returns

IEventMigrationPropertyBuilder<TTarget, TSource>

The builder for continued configuration.

Type Parameters

TProperty

The type of the target property.

DefaultValue<TProperty>(Expression<Func<TTarget, TProperty>>, TProperty)

Provide a default value for a new property that did not exist in the source generation.

IEventMigrationPropertyBuilder<TTarget, TSource> DefaultValue<TProperty>(Expression<Func<TTarget, TProperty>> targetProperty, TProperty value)

Parameters

targetProperty Expression<Func<TTarget, TProperty>>

Expression selecting the target property to set the default value on.

value TProperty

The default value.

Returns

IEventMigrationPropertyBuilder<TTarget, TSource>

The builder for continued configuration.

Type Parameters

TProperty

The type of the target property.

MapValues<TProperty, TSourceProperty>(Expression<Func<TTarget, TProperty>>, Expression<Func<TSource, TSourceProperty>>, Action<IValueMapBuilder<TSourceProperty, TProperty>>)

Translate the individual values of a property that mean something different in the target generation.

IEventMigrationPropertyBuilder<TTarget, TSource> MapValues<TProperty, TSourceProperty>(Expression<Func<TTarget, TProperty>> targetProperty, Expression<Func<TSource, TSourceProperty>> sourceProperty, Action<IValueMapBuilder<TSourceProperty, TProperty>> map)

Parameters

targetProperty Expression<Func<TTarget, TProperty>>

Expression selecting the target property to write the translated value into.

sourceProperty Expression<Func<TSource, TSourceProperty>>

Expression selecting the source property to read the value from.

map Action<IValueMapBuilder<TSourceProperty, TProperty>>

Action declaring which value becomes which.

Returns

IEventMigrationPropertyBuilder<TTarget, TSource>

The builder for continued configuration.

Type Parameters

TProperty

The type of the target property.

TSourceProperty

The type of the source property.

Remarks

This states the translation for one direction only. To state it once and have both directions follow, override MapValues on EventTypeMigration<TUpgrade, TPrevious> instead.

RenamedFrom<TProperty>(Expression<Func<TTarget, TProperty>>, Expression<Func<TSource, object>>)

Rename a property from an old name to a new target property.

IEventMigrationPropertyBuilder<TTarget, TSource> RenamedFrom<TProperty>(Expression<Func<TTarget, TProperty>> targetProperty, Expression<Func<TSource, object>> sourceProperty)

Parameters

targetProperty Expression<Func<TTarget, TProperty>>

Expression selecting the new target property.

sourceProperty Expression<Func<TSource, object>>

Expression selecting the old source property to read from.

Returns

IEventMigrationPropertyBuilder<TTarget, TSource>

The builder for continued configuration.

Type Parameters

TProperty

The type of the target property.

Split<TProperty>(Expression<Func<TTarget, TProperty>>, Expression<Func<TSource, object>>, PropertySeparator, SplitPartIndex)

Split a source property value into a target property by extracting one part.

IEventMigrationPropertyBuilder<TTarget, TSource> Split<TProperty>(Expression<Func<TTarget, TProperty>> targetProperty, Expression<Func<TSource, object>> sourceProperty, PropertySeparator separator, SplitPartIndex part)

Parameters

targetProperty Expression<Func<TTarget, TProperty>>

Expression selecting the target property to write the split result into.

sourceProperty Expression<Func<TSource, object>>

Expression selecting the source property to split.

separator PropertySeparator

The separator to use.

part SplitPartIndex

The zero-based part index to extract.

Returns

IEventMigrationPropertyBuilder<TTarget, TSource>

The builder for continued configuration.

Type Parameters

TProperty

The type of the target property.