Table of Contents

Method ForMember

Namespace
Mapperion
Assembly
Mapperion.dll

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

Configures a single destination member.

IMappingExpression<TSource, TDestination> ForMember<TMember>(Expression<Func<TDestination, TMember>> destinationMember, Action<IMemberConfigurationExpression<TSource, TDestination, TMember>> memberOptions)

Parameters

destinationMember Expression<Func<TDestination, TMember>>

A direct member access on the destination, such as d => d.Total.

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

The configuration applied to that member.

Returns

IMappingExpression<TSource, TDestination>

This expression, for chaining.

Type Parameters

TMember

The destination member type.

Exceptions

ArgumentNullException

Either argument is null.

MapperConfigurationException

destinationMember is not a direct member access.

ForMember(string, Action<IMemberConfigurationExpression<TSource, TDestination, object>>)

Configures one destination member, named as text rather than selected by an expression.

IMappingExpression<TSource, TDestination> ForMember(string destinationMember, Action<IMemberConfigurationExpression<TSource, TDestination, object>> memberOptions)

Parameters

destinationMember string

The member name, or a dotted path to one.

memberOptions Action<IMemberConfigurationExpression<TSource, TDestination, object>>

The configuration applied to that member.

Returns

IMappingExpression<TSource, TDestination>

This expression, for chaining.

Remarks

For a member chosen somewhere a lambda cannot reach — a settings file, a table of overrides, a loop. It costs the compiler's checking, so the expression overload is the one to reach for when there is a choice. A dotted name walks a path, exactly as ForPath<TMember>(Expression<Func<TDestination, TMember>>, Action<IMemberConfigurationExpression<TSource, TDestination, TMember>>) does.

Exceptions

ArgumentNullException

Either argument is null.

MapperConfigurationException

The destination has no member of that name.