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
TTargetThe target event type of the migration.
TSourceThe 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
targetPropertyExpression<Func<TTarget, TProperty>>Expression selecting the target property to write the combined result into.
separatorPropertySeparatorThe separator to use between the combined values.
sourcePropertiesExpression<Func<TSource, object>>[]Expressions selecting the source properties to concatenate.
Returns
- IEventMigrationPropertyBuilder<TTarget, TSource>
The builder for continued configuration.
Type Parameters
TPropertyThe 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
targetPropertyExpression<Func<TTarget, TProperty>>Expression selecting the target property to set the default value on.
valueTPropertyThe default value.
Returns
- IEventMigrationPropertyBuilder<TTarget, TSource>
The builder for continued configuration.
Type Parameters
TPropertyThe 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
targetPropertyExpression<Func<TTarget, TProperty>>Expression selecting the target property to write the translated value into.
sourcePropertyExpression<Func<TSource, TSourceProperty>>Expression selecting the source property to read the value from.
mapAction<IValueMapBuilder<TSourceProperty, TProperty>>Action declaring which value becomes which.
Returns
- IEventMigrationPropertyBuilder<TTarget, TSource>
The builder for continued configuration.
Type Parameters
TPropertyThe type of the target property.
TSourcePropertyThe 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
targetPropertyExpression<Func<TTarget, TProperty>>Expression selecting the new target property.
sourcePropertyExpression<Func<TSource, object>>Expression selecting the old source property to read from.
Returns
- IEventMigrationPropertyBuilder<TTarget, TSource>
The builder for continued configuration.
Type Parameters
TPropertyThe 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
targetPropertyExpression<Func<TTarget, TProperty>>Expression selecting the target property to write the split result into.
sourcePropertyExpression<Func<TSource, object>>Expression selecting the source property to split.
separatorPropertySeparatorThe separator to use.
partSplitPartIndexThe zero-based part index to extract.
Returns
- IEventMigrationPropertyBuilder<TTarget, TSource>
The builder for continued configuration.
Type Parameters
TPropertyThe type of the target property.