Mapperly
An open-source .NET library that generates object-mapping code at compile time from a partial class marked [Mapper].
In more detail
It writes ordinary assignments with no reflection at run time, and reports a diagnostic when a member cannot be mapped. Manual mapping remains the clearest choice for small or sensitive conversions.
Related terms
- object mapping — Copying data from one type to another across a boundary, such as from a database entity to an API response record.
- source generator — A compiler plug-in that writes extra C# code during the build, based on the code you wrote.
- partial class — A class or method declared with partial so that its definition can be split across files, with some parts written by a tool.
- AutoMapper — A popular .NET library that maps objects by naming convention at run time, which moved to a commercial licence in 2025.
Taught in
- Source-Generated Mapping with Mapperly — Modern .NET Core, C# & Enterprise Microservices