Skip to main content


Nuget Nuget License GitHub Sponsors GitHub

What is Mapperly?

Mapperly is a .NET source generator for generating object mappings. It drastically simplifies the implementation of object to object mappings. One only needs to define the mapping methods signature. The implementation is provided by Mapperly.

Because Mapperly creates the mapping code at build time, there is minimal overhead at runtime. Even better, the generated code is perfectly readable, allowing you to verify the generated mapping code easily.

Mapperly works by using .NET Source Generators. Since no reflection is used at runtime, the generated code is completely trimming safe and AoT friendly.

Mapperly was originally inspired by MapStruct.

Why object mappings?

In multi-layered applications, one layer often exposes different information than another. Therefore object-to-object mappings are required between the layers. Writing such boilerplate code by hand is tedious and error-prone. Mapperly automates and simplifies object-to-object mappings while preserving many benefits of mappings written by hand. Mapperly can even help you avoid bugs by providing helpful hints during the compilation process. For example, Mapperly can report a warning when there is an added property in a class which is not yet marked as ignored but neither mapped to the target class.

Why Mapperly?

  • Mapperly does not use reflection
  • Mapperly is trimming and AoT safe
  • Mapperly runs at build time
  • Mapperly does not have a runtime dependency
  • The generated mappings are amazingly fast with minimal memory overhead
  • The generated mapping code is readable and debuggable
  • No need to write and maintain boilerplate code by hand
  • Mapperly is pluggable: it is always possible to implement mappings for certain types by hand, which get picked up by Mapperly


  • .NET 5+ or .NET Framework 4.x.
  • C# language version 9 or later
  • Roslyn 4.0 or later


Mapperly is one of the fastest .NET object mapper out there, surpassing even the naive manual mapping approach! The benchmark was generated with Benchmark.netCoreMappers.

MethodMeanErrorStdDevGen 0Allocated
AgileMapper1,523.8 ns3.90 ns3.25 ns1.51063,160 B
TinyMapper4,094.3 ns3.90 ns3.05 ns1.03002,160 B
ExpressMapper2,595.8 ns5.49 ns5.14 ns2.34224,904 B
AutoMapper1,203.9 ns2.30 ns2.15 ns0.90981,904 B
ManualMapping529.6 ns0.52 ns0.44 ns0.55411,160 B
Mapster562.1 ns1.14 ns0.89 ns0.90981,904 B
Mapperly338.5 ns0.95 ns0.84 ns0.4396920 B