Mapperly generates object-to-object mapping implementations at build time from partial mapper classes. It avoids runtime reflection and produces readable code that is trimming-safe and AOT friendly.
Overview
Mapperly is a NuGet package that uses .NET source generators to implement mapping methods you declare on partial classes annotated with MapperAttribute. You define signatures; the generator supplies the bodies during compilation.
Because mapping code exists before runtime, overhead stays low and you can read the generated C# to verify behavior. The tool relies on Roslyn source generators rather than reflection, which suits trimmed and ahead-of-time compiled applications.
Documentation covers installation, mapper declarations, configuration, and upgrade notes including breaking changes between major versions. Stable and preview NuGet channels are described, with stable releases intended for production. Support policy focuses on the latest stable release and Microsoft-supported .NET versions.
Contributions and enterprise consulting are offered through the riok project channels.
Key features
- Build-time mapping code generation
- Partial class mapper declarations
- No runtime reflection
- Human-readable generated code
- Trimming and AOT compatible
- NuGet stable and next channels
- Roslyn source generator based
Use cases
- DTO to domain model mapping
- API layer object projections
- Replace hand-written mapping boilerplate
- AOT or trimmed .NET deployments
- Verify mappings by reading generated C#