Skip to content
/ mapperly Public
  • Sponsor
  • Notifications You must be signed in to change notification settings
  • Fork 156

A .NET source generator for generating object mappings. No runtime reflection.

License

Notifications You must be signed in to change notification settings

riok/mapperly

Folders and files

NameName
Last commit message
Last commit date
Mar 11, 2025
Jan 14, 2025
Jun 18, 2024
Mar 11, 2025
Oct 24, 2024
Mar 11, 2025
Aug 28, 2024
Mar 19, 2025
Mar 18, 2025
Apr 19, 2023
Oct 24, 2024
Oct 4, 2024
Aug 28, 2023
Apr 9, 2024
Jan 20, 2023
Jan 17, 2023
Nov 19, 2024
Feb 14, 2022
Oct 12, 2023
Dec 21, 2023
Jan 20, 2025
Nov 19, 2024

Mapperly

Nuget Nuget Preview License Downloads GitHub Sponsors GitHub

Mapperly is a .NET source generator for generating object mappings.

Because Mapperly creates the mapping code at build time, there is minimal overhead at runtime. Even better, the generated code is perfectly readable, allowing you to verify the generated mapping code easily.

Documentation

The documentation is available here.

Quickstart

Installation

Add the NuGet Package to your project:

dotnet add package Riok.Mapperly

Create your first mapper

Create a mapper declaration as a partial class and apply the Riok.Mapperly.Abstractions.MapperAttribute attribute. Mapperly generates mapping method implementations for the defined mapping methods in the mapper.

// Mapper declaration
[Mapper]
public partial class CarMapper
{
    public partial CarDto CarToCarDto(Car car);
}

// Mapper usage
var mapper = new CarMapper();
var car = new Car { NumberOfSeats = 10, ... };
var dto = mapper.CarToCarDto(car);
dto.NumberOfSeats.Should().Be(10);

Read the docs for any further information.

Upgrading

Find a list of breaking changes for each major version and upgrade guides here.

How To Contribute

We would love for you to contribute to Mapperly and help make it even better than it is today! Find information on how to contribute in the docs.

License

Mapperly is Apache 2.0 licensed.

Sponsor this project

Sponsor