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
TTargetThe target event type of the migration.
TSourceThe source event type of the migration.
- Inheritance
-
EventMigrationPropertyBuilderFor<TTarget, TSource>
- Implements
-
IEventMigrationPropertyBuilder<TTarget, TSource>
- 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
innerIEventMigrationPropertyBuilderThe 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
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.
public 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.
public 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.
public 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.
public 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.