IronMapper 1.1.0

dotnet add package IronMapper --version 1.1.0
                    
NuGet\Install-Package IronMapper -Version 1.1.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="IronMapper" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IronMapper" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="IronMapper" />
                    
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 IronMapper --version 1.1.0
                    
#r "nuget: IronMapper, 1.1.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 IronMapper@1.1.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=IronMapper&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=IronMapper&version=1.1.0
                    
Install as a Cake Tool

IronMapper

NuGet Build License: MIT

📖 Русская документация

Zero-reflection, compile-time object mapper for .NET.

IronMapper generates all mapping code at build time using a Roslyn Source Generator — no runtime reflection, no IL emit, no dynamic proxies. Just plain, readable, debuggable C# that the compiler can optimize like any other code.


vs AutoMapper

Feature AutoMapper IronMapper
Mapping strategy Reflection at runtime Source-generated C# at compile time
Misconfiguration detected At app startup At dotnet build
NativeAOT / IL trimming Requires annotations Fully compatible
Performance ~2–5 µs / object ~0 ns overhead
License MIT MIT
API style Profile-based fluent API Attributes or Profile-based fluent API
Package size ~500 KB ~30 KB

Quick Start (5 minutes)

1. Install

dotnet add package IronMapper

2. Annotate your source type

using IronMapper.Attributes;

[MapTo(typeof(UserDto))]
public class UserEntity
{
    public int    Id    { get; set; }
    public string Name  { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
}

public class UserDto
{
    public int    Id    { get; set; }
    public string Name  { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
}

3. Map

var entity = new UserEntity { Id = 1, Name = "Alice", Email = "alice@example.com" };
UserDto dto = entity.MapToUserDto();  // generated extension method

That's it. No IMapper, no service registration, no startup overhead.


Key Features

Attribute-based mapping

[MapTo(typeof(ProductDto))]      // source → dest
[MapFrom(typeof(ProductEntity))] // dest ← source (equivalent)

Property renaming

[MapProperty("FullName")]
public string Name { get; set; } = "";  // maps to FullName on destination

Ignore properties

[Ignore]
public string InternalSecret { get; set; } = "";

Custom type converters

public class PriceConverter : ITypeConverter<decimal, string>
{
    public string Convert(decimal source) => source.ToString("F2");
}

[MapTo(typeof(InvoiceDto))]
public class Invoice
{
    [MapConverter(typeof(PriceConverter))]
    public decimal Total { get; set; }
}

Profile-based fluent API

public class OrderProfile : MappingProfile
{
    public OrderProfile()
    {
        CreateMap<OrderEntity, OrderDto>()
            .ForMember(d => d.FullAddress, o => o.MapFrom(s => s.Street + ", " + s.City))
            .ForMember(d => d.InternalId,  o => o.Ignore());
    }
}

Collection helpers

List<UserEntity> entities = ...;
List<UserDto>    dtos = entities.MapToUserDtoList();
UserDto[]        arr  = entities.MapToUserDtoArray();

In-place (void) mapping

entity.MapToUserDto(existingDto);  // updates existing object without allocating a new one

Nested collections

[MapTo(typeof(BlogDto))]
public class BlogEntity
{
    public List<CommentEntity> Comments { get; set; } = new();
}
// generator emits: Comments = Enumerable.ToList(Enumerable.Select(source.Comments, x => x.MapToCommentDto()))

ASP.NET Core DI

// Program.cs
builder.Services.AddIronMapper(typeof(Program).Assembly);

// In a controller / service
public class OrdersController(IMapper mapper) : ControllerBase
{
    public OrderDto Get(int id) => mapper.Map<OrderDto>(_repo.GetById(id));
}

Demo Application

We've built a sample console app that showcases all IronMapper features using the real Open Library API (no API key required).

What the demo covers:

  • Simple attribute-based mapping ([MapTo])
  • Fluent API with MappingProfile
  • Collection mapping (List<BookDoc>List<BookSummary>)
  • Nested object mapping (Book + Author)
  • Custom type converters (HTML bio cleaner)
  • Conditional mapping (living authors only)

Run it:

git clone https://github.com/iron-mapper/IronMapper
cd IronMapper
dotnet run --project samples/IronMapper.Demo

Documentation


Contributing

Contributions are welcome! Please:

  1. Fork the repo and create a feature branch (feature/my-feature).
  2. Make your changes with tests.
  3. Run dotnet build and dotnet test — both must be clean.
  4. Open a pull request against main.

Please follow the existing code style (see .editorconfig).


License

MIT © Iron Programmer School

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on IronMapper:

Package Downloads
IronMapper.Extensions.DI

ASP.NET Core / Microsoft DI integration for IronMapper — zero-reflection compile-time object mapper.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 139 4/7/2026
1.0.0 137 4/2/2026