MapDerivedTypeAttribute
Namespace: Riok.Mapperly.Abstractions
Specifies derived type mappings for which a mapping should be generated. A type switch is implemented over the source object and the provided source types. Each source type has to be unique but multiple source types can be mapped to the same target type. Each source type needs to extend or implement the parameter type of the mapping method. Each target type needs to extend or implement the return type of the mapping method.
public sealed class MapDerivedTypeAttribute : System.Attribute
Inheritance Object → Attribute → MapDerivedTypeAttribute
Attributes NullableContextAttribute, NullableAttribute, AttributeUsageAttribute, ConditionalAttribute
Properties
SourceType
Gets the source type of the derived type mapping.
public Type SourceType { get; }
Property Value
TargetType
Gets the target type of the derived type mapping.
public Type TargetType { get; }
Property Value
TypeId
public object TypeId { get; }
Property Value
Constructors
MapDerivedTypeAttribute(Type, Type)
Registers a derived type mapping.
public MapDerivedTypeAttribute(Type sourceType, Type targetType)
Parameters
sourceType
Type
The derived source type.
targetType
Type
The derived target type.