Class ObjectMap<TSource, TDestination>
Represents an object map.
Implements
Inherited Members
Namespace: Swan.Mappers
Syntax
public class ObjectMap<TSource, TDestination> : IObjectMap
Type Parameters
| Name | Description |
|---|---|
| TSource | The type of the source. |
| TDestination | The type of the destination. |
Properties
DestinationType
Gets or sets the type of the destination.
Declaration
public Type DestinationType { get; }
Property Value
| Type | Description |
|---|---|
| Type |
Map
Gets or sets the map.
Declaration
public Dictionary<PropertyInfo, List<PropertyInfo>> Map { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<PropertyInfo, List<PropertyInfo>> |
SourceType
Gets or sets the type of the source.
Declaration
public Type SourceType { get; }
Property Value
| Type | Description |
|---|---|
| Type |
Methods
MapProperty<TDestinationProperty, TSourceProperty>(Expression<Func<TDestination, TDestinationProperty>>, Expression<Func<TSource, TSourceProperty>>)
Maps the property.
Declaration
public ObjectMap<TSource, TDestination> MapProperty<TDestinationProperty, TSourceProperty>(Expression<Func<TDestination, TDestinationProperty>> destinationProperty, Expression<Func<TSource, TSourceProperty>> sourceProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<TDestination, TDestinationProperty>> | destinationProperty | The destination property. |
| Expression<Func<TSource, TSourceProperty>> | sourceProperty | The source property. |
Returns
| Type | Description |
|---|---|
| ObjectMap<TSource, TDestination> | An object map representation of type of the destination property and type of the source property. |
Type Parameters
| Name | Description |
|---|---|
| TDestinationProperty | The type of the destination property. |
| TSourceProperty | The type of the source property. |
RemoveMapProperty<TDestinationProperty>(Expression<Func<TDestination, TDestinationProperty>>)
Removes the map property.
Declaration
public ObjectMap<TSource, TDestination> RemoveMapProperty<TDestinationProperty>(Expression<Func<TDestination, TDestinationProperty>> destinationProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<TDestination, TDestinationProperty>> | destinationProperty | The destination property. |
Returns
| Type | Description |
|---|---|
| ObjectMap<TSource, TDestination> | An object map representation of type of the destination property and type of the source property. |
Type Parameters
| Name | Description |
|---|---|
| TDestinationProperty | The type of the destination property. |
Exceptions
| Type | Condition |
|---|---|
| Exception | Invalid destination expression. |