Skip to main content

MappingConversionType

Namespace: Riok.Mapperly.Abstractions

A MappingConversionType represents a type of conversion how one type can be converted into another.

public enum MappingConversionType

Inheritance ObjectValueTypeEnumMappingConversionType
Implements IComparable, ISpanFormattable, IFormattable, IConvertible
Attributes FlagsAttribute

Fields

NameValueDescription
None0None.
Constructor1Use the constructor of the target type, which accepts the source type as a single parameter.
ImplicitCast2An implicit cast from the source type to the target type.
ExplicitCast4An explicit cast from the source type to the target type.
ParseMethod8If the source type is a String, uses a a static visible method named Parse on the target type with a return type equal to the target type and a string as single parameter.
ToStringMethod16If the target type is a String, uses the ToString method on the source type.
StringToEnum32If the target is an Enum and the source is a String, parses the string to match the name of an enum member.
EnumToString64If the source is an Enum and the target is a String, uses the name of the enum member to convert it to a string.
EnumToEnum128If the source is an Enum and the target is another Enum, map it according to the EnumMappingStrategy.
DateTimeToDateOnly256If the source is a DateTime and the target is a DateOnly uses the FromDateTime method on the target type with the source as single parameter.
DateTimeToTimeOnly512If the source is a DateTime and the target is a TimeOnly uses the FromDateTime method on the target type with the source as single parameter.
Queryable1024If the source and the target is a . Only uses object initializers and inlines the mapping code.
Enumerable2048If the source and the target is an IEnumerable<T> Maps each element individually.
Dictionary4096If the source and targets are IDictionary<TKey, TValue> or IReadOnlyDictionary<TKey, TValue>. Maps each KeyValuePair<TKey, TValue> individually.
Span8192If the source or target is a Span<T> or ReadOnlySpan<T> Maps each element individually.
Memory16384If the source or target is a Memory<T> or ReadOnlyMemory<T> Maps each element individually.
Tuple32768If the target is a ValueTuple<T1, T2> or tuple expression (A: 10, B: 12). Supports positional and named mapping. Only uses ValueTuple<T1, T2> in .
EnumUnderlyingType65536Allow using the underlying type of an enum to map from or to an enum type.
All-1Enables all supported conversions.