Class EventMigrationPropertyBuilderFor<TTarget, TSource>

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

Represents an implementation of IEventMigrationPropertyBuilder<TTarget, TSource> that converts expression-based property accessors to PropertyName values and delegates to the underlying IEventMigrationPropertyBuilder.

public class EventMigrationPropertyBuilderFor<TTarget, TSource> : IEventMigrationPropertyBuilder<TTarget, TSource>

Type Parameters

TTarget

The target event type of the migration.

TSource

The source event type of the migration.

Inheritance
EventMigrationPropertyBuilderFor<TTarget, TSource>
Implements
Inherited Members
Extension Methods

Constructors

EventMigrationPropertyBuilderFor(IEventMigrationPropertyBuilder)

Represents an implementation of IEventMigrationPropertyBuilder<TTarget, TSource> that converts expression-based property accessors to PropertyName values and delegates to the underlying IEventMigrationPropertyBuilder.

public EventMigrationPropertyBuilderFor(IEventMigrationPropertyBuilder inner)

Parameters

inner IEventMigrationPropertyBuilder

The underlying IEventMigrationPropertyBuilder to delegate to.

Methods

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

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

public 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.

public 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.

public 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.

public 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.

public 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.