Class Mapper<TFrom, TTo>
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
TFromObject 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
TFromObject to map.
destination
TToDestination 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
TFromObject to map.
destination
TToDestination object.
crossReferenceDictionary
IDictionary<object, object>Storage for cress references if applied.
Returns
- TTo
Destination object.