Riok.Mapperly by Mapperly Contributors, Lars Tönz, Manuel Allenspach

<PackageReference Include="Riok.Mapperly" Version="3.1.0-next.2" />

 MapperAttribute

public sealed class MapperAttribute : Attribute
Marks an abstract class or an interface as a mapper.
public bool AllowNullPropertyAssignment { get; set; }

Specifies whether null values are assigned to the target. If true (default), the source is null, and the target does allow null values, null is assigned. If false, null values are never assigned to the target property. This is ignored for required init properties and IQueryable<T> projection mappings.

Enabled conversions which Mapperly automatically implements. By default all supported type conversions are enabled. Eg. to disable all automatically implemented conversions:EnabledConversions = MappingConversionType.NoneEg. to disable ToString() method calls:EnabledConversions = MappingConversionType.All & ~MappingConversionType.ToStringMethod

public bool EnumMappingIgnoreCase { get; set; }

Whether the case should be ignored for enum mappings.

The default enum mapping strategy. Can be overwritten on specific enums via mapping method configurations.

The ignore obsolete attribute strategy. Determines how ObsoleteAttribute marked members are mapped. Defaults to None.

Strategy on how to match mapping property names.

public bool ThrowOnMappingNullMismatch { get; set; }

Specifies the behaviour in the case when the mapper tries to return null in a mapping method with a non-nullable return type. If set to true an ArgumentNullException is thrown. If set to false the mapper tries to return a default value. For a String this is Empty, for value types default and for reference types new() if a parameterless constructor exists or else an ArgumentNullException is thrown.

public bool ThrowOnPropertyMappingNullMismatch { get; set; }

Specifies the behaviour in the case when the mapper tries to set a non-nullable property to a null value. If set to true an ArgumentNullException is thrown. If set to false the property assignment is ignored. This is ignored for required init properties and IQueryable<T> projection mappings.

public bool UseDeepCloning { get; set; }

Whether to always deep copy objects. Eg. when the type Person[] should be mapped to the same type Person[], when false, the same array is reused. when true, the array and each person is cloned.

public bool UseReferenceHandling { get; set; }

Enables the reference handling feature. Disabled by default for performance reasons. When enabled, an IReferenceHandler instance is passed through the mapping methods to keep track of and reuse existing target object instances.

public MapperAttribute()