Class TypeMapperExtensions
Contains ITypeMapper extension methods.
public static class TypeMapperExtensions
- Inheritance
-
TypeMapperExtensions
- Inherited Members
Methods
Configure(ITypeMapperBuilder, params ITypeMappingConfiguration[])
Adds a collection of ITypeMappingConfiguration instances to this builder.
public static ITypeMapperBuilder Configure(this ITypeMapperBuilder builder, params ITypeMappingConfiguration[] configurations)
Parameters
builderITypeMapperBuilderSource builder.
configurationsITypeMappingConfiguration[]A collection ITypeMappingConfiguration instances to add to this builder.
Returns
- ITypeMapperBuilder
builder.
IsConfigured<TSource, TDestination>(ITypeMapper)
Checks whether or not the mapping definition from TSource to TDestination exists.
[Pure]
public static bool IsConfigured<TSource, TDestination>(this ITypeMapper mapper)
Parameters
mapperITypeMapperType mapper.
Returns
- bool
true when mapping definition exists, otherwise false.
Type Parameters
TSourceSource type.
TDestinationDestination type.
Map(ITypeMapper, Type, object)
Maps the provided source to the desired destinationType type.
[Pure]
public static object Map(this ITypeMapper mapper, Type destinationType, object source)
Parameters
mapperITypeMapperType mapper.
destinationTypeTypeDesired destination type.
sourceobjectSource object.
Returns
- object
sourcemapped to thedestinationTypetype.
Exceptions
- UndefinedTypeMappingException
When mapping from
sourceobject's type todestinationTypeis not defined.
MapMany<TSource>(ITypeMapper, IEnumerable<TSource>)
Creates a new TypeMappingManyContext<TSource> instance
for the provided source collection with elements of TSource type.
[Pure]
public static TypeMappingManyContext<TSource> MapMany<TSource>(this ITypeMapper mapper, IEnumerable<TSource> source)
Parameters
mapperITypeMapperType mapper.
sourceIEnumerable<TSource>Source collection.
Returns
- TypeMappingManyContext<TSource>
New TypeMappingManyContext<TSource> instance.
Type Parameters
TSourceSource collection's element type.
MapMany<TSource>(ITypeMapper, params TSource[])
Creates a new TypeMappingManyContext<TSource> instance
for the provided source collection with elements of TSource type.
[Pure]
public static TypeMappingManyContext<TSource> MapMany<TSource>(this ITypeMapper mapper, params TSource[] source)
Parameters
mapperITypeMapperType mapper.
sourceTSource[]Source collection.
Returns
- TypeMappingManyContext<TSource>
New TypeMappingManyContext<TSource> instance.
Type Parameters
TSourceSource collection's element type.
MapMany<TSource, TDestination>(ITypeMapper, IEnumerable<TSource>)
Maps the provided source collection with elements of TSource type
to a collection with elements of the desired TDestination type.
[Pure]
public static IEnumerable<TDestination> MapMany<TSource, TDestination>(this ITypeMapper mapper, IEnumerable<TSource> source)
Parameters
mapperITypeMapperType mapper.
sourceIEnumerable<TSource>Source collection.
Returns
- IEnumerable<TDestination>
sourcecollection mapped to collection with elements of theTDestinationtype.
Type Parameters
TSourceSource collection's element type.
TDestinationDesired destination collection's element type.
Exceptions
- UndefinedTypeMappingException
When mapping from
TSourcetoTDestinationis not defined.
MapMany<TSource, TDestination>(ITypeMapper, params TSource[])
Maps the provided source collection with elements of TSource type
to a collection with elements of the desired TDestination type.
[Pure]
public static IEnumerable<TDestination> MapMany<TSource, TDestination>(this ITypeMapper mapper, params TSource[] source)
Parameters
mapperITypeMapperType mapper.
sourceTSource[]Source collection.
Returns
- IEnumerable<TDestination>
sourcecollection mapped to collection with elements of theTDestinationtype.
Type Parameters
TSourceSource collection's element type.
TDestinationDesired destination collection's element type.
Map<TDestination>(ITypeMapper, object)
Maps the provided source to the desired TDestination type.
[Pure]
public static TDestination Map<TDestination>(this ITypeMapper mapper, object source)
Parameters
mapperITypeMapperType mapper.
sourceobjectSource object.
Returns
- TDestination
sourcemapped to theTDestinationtype.
Type Parameters
TDestinationDesired destination type.
Exceptions
- UndefinedTypeMappingException
When mapping from
sourceobject's type toTDestinationis not defined.
Map<TSource>(ITypeMapper, TSource)
Creates a new TypeMappingContext<TSource> instance
for the provided source of TSource type.
[Pure]
public static TypeMappingContext<TSource> Map<TSource>(this ITypeMapper mapper, TSource source)
Parameters
mapperITypeMapperType mapper.
sourceTSourceSource object.
Returns
- TypeMappingContext<TSource>
New TypeMappingContext<TSource> instance.
Type Parameters
TSourceSource object type.
Map<TSource, TDestination>(ITypeMapper, TSource)
Maps the provided source of TSource type
to the desired TDestination type.
[Pure]
public static TDestination Map<TSource, TDestination>(this ITypeMapper mapper, TSource source)
Parameters
mapperITypeMapperType mapper.
sourceTSourceSource object.
Returns
- TDestination
sourcemapped to theTDestinationtype.
Type Parameters
TSourceSource object type.
TDestinationDesired destination type.
Exceptions
- UndefinedTypeMappingException
When mapping from
TSourcetoTDestinationis not defined.