Table of Contents

Method ForPath

Namespace
Mapperion
Assembly
Mapperion.dll

ForPath<TMember>(Expression<Func<TDestination, TMember>>, Action<IMemberConfigurationExpression<TSource, TDestination, TMember>>)

Configures a member that sits inside the destination rather than on it, such as d => d.Customer.Name.

IMappingExpression<TSource, TDestination> ForPath<TMember>(Expression<Func<TDestination, TMember>> destinationPath, Action<IMemberConfigurationExpression<TSource, TDestination, TMember>> pathOptions)

Parameters

destinationPath Expression<Func<TDestination, TMember>>

A chain of member accesses on the destination.

pathOptions Action<IMemberConfigurationExpression<TSource, TDestination, TMember>>

The configuration applied to the member at the end.

Returns

IMappingExpression<TSource, TDestination>

This expression, for chaining.

Type Parameters

TMember

The type of the member at the end of the path.

Remarks

The objects along the path are created as needed, so the destination does not have to arrive with them already in place. A step that cannot be written and is null has to be there: nothing can put it there, and the map says so when it runs.

Paths are assigned after every direct member, so configuring both the whole object and something inside it leaves the path with the last word rather than depending on declaration order. A single-step path is just a member, and is treated as one.

Exceptions

ArgumentNullException

Either argument is null.

MapperConfigurationException

destinationPath is not a chain of member accesses, ends on something that cannot be written, or goes through a value type or a method call.