Easy-Mapper
1.0.1
dotnet add package Easy-Mapper --version 1.0.1
NuGet\Install-Package Easy-Mapper -Version 1.0.1
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="Easy-Mapper" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Easy-Mapper" Version="1.0.1" />
<PackageReference Include="Easy-Mapper" />
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 Easy-Mapper --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Easy-Mapper, 1.0.1"
#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 Easy-Mapper@1.0.1
#: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=Easy-Mapper&version=1.0.1
#tool nuget:?package=Easy-Mapper&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EasyMapper
EasyMapper is a blazing-fast, reflection-free object mapper for .NET 8 and .NET 9 โ designed as a free alternative to AutoMapper.
It uses IL emission, expression trees, and runtime caching to deliver mapping speeds close to handwritten code.
๐ Features
- โก Up to 2โ3ร faster than AutoMapper
- ๐ง Zero reflection at runtime
- ๐ Nested object mapping supported
- ๐ฏ Ignore, CustomMap, and ValueConverter per member
- ๐งฉ Thread-safe and cache-optimized
- ๐งฐ Works with Dependency Injection (
AddEasyMapper) - โ Free for commercial use (MIT license)
- ๐งฑ Compatible with NativeAOT
๐ฆ Installation
dotnet add package EasyMapper
๐งฐ Basic Usage
using EasyMapper;
using EasyMapper.Configuration;
// Configure mappings once at startup
MapperConfig.CreateMap<UserDto, User>();
// Map objects
var user = EasyMapper.Map<UserDto, User>(new UserDto
{
Name = "Alice",
Age = 25
});
๐งฉ Advanced Configuration
MapperConfig.CreateMap<UserDto, User>()
.ForMember("Age", opt => opt.ValueConverter = a => (int)a! + 1)
.ForMember("Name", opt => opt.CustomMap = src => src.Name.ToUpper())
.IgnoreMember("Password");
๐ In-Place Mapping
var source = new UserDto { Name = "Bob", Age = 30 };
var destination = new User();
EasyMapper.Map(source, destination);
๐งฑ Dependency Injection
builder.Services.AddEasyMapper();
Then inject anywhere:
public class MyService
{
private readonly IMappingEngine _mapper;
public MyService(IMappingEngine mapper)
{
_mapper = mapper;
}
public void DoSomething(UserDto dto)
{
var entity = _mapper.Map<UserDto, User>(dto);
}
}
๐งช Benchmark (Intel i5-8350U, .NET 9.0)
| Mapper | Time (ns) | Relative | Alloc (B) |
|---|---|---|---|
| Handwritten | 18.49 ns | 1.00ร | 96 B |
| EasyMapper (new) | 54.98 ns | 2.97ร | 96 B |
| EasyMapper (in place) | 42.10 ns | 2.28ร | 24 B |
| AutoMapper | 88.18 ns | 4.77ร | 96 B |
๐งพ License
Licensed under the MIT License โ completely free for commercial and personal use.
โค๏ธ Author
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net9.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.