📄️ Mapper configuration
The MapperAttribute provides options to customize the generated mapper class.
📄️ Static mappers and extension methods
Mapperly supports static mappers and extension methods:
📄️ Flattening and unflattening
It is pretty common to flatten objects during mapping, eg. Car.Make.Id => CarDto.MakeId.
📄️ Enum mappings
An enum mapping can be customized by setting the strategy to use.
📄️ Before / after map
To run custom code before or after a mapping, the generated map method can be wrapped in a custom method:
📄️ User implemented mapping methods
If Mapperly cannot generate a mapping, one can implement it manually simply by providing a method body in the mapper declaration:
📄️ Constructor mappings
Mapperly supports using parameterized constructors of mapping target types.
📄️ Object Factories
By default the generated code will instantiate objects using the default parameterless constructor if available.
📄️ Void mapping methods
If an existing object instance should be used as target, you can define the mapping method as void with the target as second parameter:
📄️ Reference handling
Mapperly can support mapping object structures with circular references.
📄️ IQueryable projections
Mapperly does support IQueryable projections:
Mapperly implements several types of automatic conversions (in order of priority):
📄️ Analyzer diagnostics
Mapperly emits several diagnostics:
📄️ Generated source
Most IDEs allow you to view the source code generated by Mapperly. Usually you can jump to the implementation via the partial mapper method.