DotNetMapper 2.0.0

dotnet add package DotNetMapper --version 2.0.0
                    
NuGet\Install-Package DotNetMapper -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotNetMapper" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotNetMapper" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DotNetMapper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DotNetMapper --version 2.0.0
                    
#r "nuget: DotNetMapper, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DotNetMapper@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DotNetMapper&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DotNetMapper&version=2.0.0
                    
Install as a Cake Tool

DotNetMapper

NuGet CI

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:

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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