Class Mapper<TFrom, TTo>
Maps an object of TFrom type to an object of TTo type.
Inheritance
Namespace: LinqToDB.Tools.Mapper
Assembly: linq2db.Tools.dll
Syntax
public class Mapper<TFrom, TTo> : object
Type Parameters
Name | Description |
---|---|
TFrom | Type to map from. |
TTo | Type to map to. |
Examples
This example shows how to map one object to another.
Methods
| Improve this Doc View SourceGetMapper()
Returns a mapper to map an object of TFrom type to an object of TTo type.
Declaration
public Func<TFrom, TTo> GetMapper()
Returns
Type | Description |
---|---|
Func<TFrom, TTo> | Mapping expression. |
GetMapperEx()
Returns a mapper to map an object of TFrom type to an object of TTo type.
Declaration
public Func<TFrom, TTo, IDictionary<object, object>?, TTo> GetMapperEx()
Returns
Type | Description |
---|---|
Func<TFrom, TTo, System.Nullable<IDictionary<System.Object, System.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.
Declaration
public Expression<Func<TFrom, TTo>> GetMapperExpression()
Returns
Type | Description |
---|---|
Expression<Func<TFrom, TTo>> | Mapping expression. |
GetMapperExpressionEx()
Returns a mapper expression to map an object of TFrom type to an object of TTo type.
Declaration
public Expression<Func<TFrom, TTo, IDictionary<object, object>?, TTo>> GetMapperExpressionEx()
Returns
Type | Description |
---|---|
Expression<Func<TFrom, TTo, System.Nullable<IDictionary<System.Object, System.Object>>, TTo>> | Mapping expression. |
Map(TFrom)
Returns a mapper to map an object of TFrom type to an object of TTo type.
Declaration
public TTo Map(TFrom source)
Parameters
Type | Name | Description |
---|---|---|
TFrom | source | Object to map. |
Returns
Type | Description |
---|---|
TTo | Destination object. |
Map(TFrom, TTo)
Returns a mapper to map an object of TFrom type to an object of TTo type.
Declaration
public TTo Map(TFrom source, TTo destination)
Parameters
Type | Name | Description |
---|---|---|
TFrom | source | Object to map. |
TTo | destination | Destination object. |
Returns
Type | Description |
---|---|
TTo | Destination object. |
Map(TFrom, TTo, Nullable<IDictionary<Object, Object>>)
Returns a mapper to map an object of TFrom type to an object of TTo type.
Declaration
public TTo Map(TFrom source, TTo destination, IDictionary<object, object>? crossReferenceDictionary)
Parameters
Type | Name | Description |
---|---|---|
TFrom | source | Object to map. |
TTo | destination | Destination object. |
System.Nullable<IDictionary<System.Object, System.Object>> | crossReferenceDictionary | Storage for cress references if applied. |
Returns
Type | Description |
---|---|
TTo | Destination object. |