Table of Contents

Class Mapper<TFrom, TTo>

Namespace
LinqToDB.Tools.Mapper
Assembly
linq2db.Tools.dll

Maps an object of TFrom type to an object of TTo type.

public class Mapper<TFrom, TTo>

Type Parameters

TFrom

Type to map from.

TTo

Type to map to.

Inheritance
Mapper<TFrom, TTo>
Extension Methods

Examples

This example shows how to map one object to another.

Methods

GetMapper()

Returns a mapper to map an object of TFrom type to an object of TTo type.

public Func<TFrom, TTo> GetMapper()

Returns

Func<TFrom, TTo>

Mapping expression.

GetMapperEx()

Returns a mapper to map an object of TFrom type to an object of TTo type.

public Func<TFrom, TTo, IDictionary<object, object>?, TTo> GetMapperEx()

Returns

Func<TFrom, TTo, IDictionary<object, object>, TTo>

Mapping expression.

GetMapperExpression()

Returns a mapper expression to map an object of TFrom type to an object of TTo type. Returned expression is compatible to IQueryable.

public Expression<Func<TFrom, TTo>> GetMapperExpression()

Returns

Expression<Func<TFrom, TTo>>

Mapping expression.

GetMapperExpressionEx()

Returns a mapper expression to map an object of TFrom type to an object of TTo type.

public Expression<Func<TFrom, TTo, IDictionary<object, object>?, TTo>> GetMapperExpressionEx()

Returns

Expression<Func<TFrom, TTo, IDictionary<object, object>, TTo>>

Mapping expression.

Map(TFrom)

Returns a mapper to map an object of TFrom type to an object of TTo type.

public TTo Map(TFrom source)

Parameters

source TFrom

Object to map.

Returns

TTo

Destination object.

Map(TFrom, TTo)

Returns a mapper to map an object of TFrom type to an object of TTo type.

public TTo Map(TFrom source, TTo destination)

Parameters

source TFrom

Object to map.

destination TTo

Destination object.

Returns

TTo

Destination object.

Map(TFrom, TTo, IDictionary<object, object>?)

Returns a mapper to map an object of TFrom type to an object of TTo type.

public TTo Map(TFrom source, TTo destination, IDictionary<object, object>? crossReferenceDictionary)

Parameters

source TFrom

Object to map.

destination TTo

Destination object.

crossReferenceDictionary IDictionary<object, object>

Storage for cress references if applied.

Returns

TTo

Destination object.