DotNetMapper 2.0.0
dotnet add package DotNetMapper --version 2.0.0
NuGet\Install-Package DotNetMapper -Version 2.0.0
<PackageReference Include="DotNetMapper" Version="2.0.0" />
<PackageVersion Include="DotNetMapper" Version="2.0.0" />
<PackageReference Include="DotNetMapper" />
paket add DotNetMapper --version 2.0.0
#r "nuget: DotNetMapper, 2.0.0"
#:package DotNetMapper@2.0.0
#addin nuget:?package=DotNetMapper&version=2.0.0
#tool nuget:?package=DotNetMapper&version=2.0.0
DotNetMapper
A zero-config object mapper for .NET with one method. It copies public properties that have the same name and the same type into a new object. A bundled source generator turns each call into the code you would write by hand, so it runs at hand-written speed and is NativeAOT safe.
dotnet add package DotNetMapper
Requires .NET 10.
Usage
using DotNetMapper;
UserDto dto = Mapper.Map<UserEntity, UserDto>(entity);
No attributes, profiles or configuration. Properties without a match are ignored, values are
assigned rather than cloned, and types must be identical: int is not copied to long.
Performance
Mapping a 10-property class on .NET 10. Lower is better.
| Library | Mean | vs hand-written | Allocated |
|---|---|---|---|
| Hand-written | 13.5 ns | 1.00 | 136 B |
| DotNetMapper 2.0 | 12.7 ns | 0.94 | 136 B |
| Mapperly 4.3 | 13.8 ns | 1.03 | 136 B |
| Mapster 10.0 | 33.9 ns | 2.52 | 208 B |
| AutoMapper 16.2 | 61.5 ns | 4.57 | 224 B |
| TinyMapper 3.0 | 62.0 ns | 4.61 | 272 B |
| AgileMapper 1.8 | 242.4 ns | 18.01 | 456 B |
DotNetMapper and Mapperly both emit the hand-written code, so they are equal within noise. The benchmarks have the full tables, setup and how to run them.
Docs
The wiki has every rule with examples:
- Mapping rules: which properties are copied, setters, records, inheritance, interfaces.
- Generated code: how to see it,
when a call falls back to the runtime path,
IQueryable, NativeAOT and IL2091. - Migrating from 1.x.
When to use something else
If you need renaming, type conversion, flattening or configuration, use Mapperly. DotNetMapper is deliberately the one-method case.
License
MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 90 | 10/7/2026 |
| 2.0.0-beta.1 | 54 | 10/6/2026 |
| 1.0.2 | 423 | 3/18/2023 |
| 1.0.1 | 339 | 3/18/2023 |
| 1.0.0 | 334 | 3/18/2023 |