Riok.Mapperly 2.8.0

Mapperly

Nuget Nuget Preview GitHub Downloads GitHub

Mapperly is a .NET source generator for generating object mappings. Inspired by MapStruct.

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.

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.

No packages depend on Riok.Mapperly.

# [2.8.0](https://github.com/riok/mapperly/compare/v2.7.0...v2.8.0) (2023-04-27) ### Bug Fixes * add fully qualified Names for method parameters, return types, new constructor call and generic types ([#318](https://github.com/riok/mapperly/issues/318)) ([36830e8](https://github.com/riok/mapperly/commit/36830e8f8b56ec2aa0c839af8844dc5beb7c1de1)) * add target type to the RMG012 diagnostic ([#310](https://github.com/riok/mapperly/issues/310)) ([c092049](https://github.com/riok/mapperly/commit/c0920494efdd52345c6efdc4a0c021c9b4e5da64)) * create a new NameBuilder scope inside lambda expressions ([#358](https://github.com/riok/mapperly/issues/358)) ([1b475a7](https://github.com/riok/mapperly/commit/1b475a74147570716890b2d1f541ba16f847d09e)) * do not diagnostic property not found if target is read only ([#345](https://github.com/riok/mapperly/issues/345)) ([6ec7e80](https://github.com/riok/mapperly/commit/6ec7e802b301e792ef6786dcd7d1c9d37b80085c)) * dont map to read only dictionaries ([#285](https://github.com/riok/mapperly/issues/285)) ([dce4b42](https://github.com/riok/mapperly/commit/dce4b422f82bf523b572e22fff0b28e223a83a5d)) * enable static user methods for instance mappers ([#364](https://github.com/riok/mapperly/issues/364)) ([7e1cb8f](https://github.com/riok/mapperly/commit/7e1cb8fcf1331a62e775528163ec8e5a4af7865d)) * ignore static fields and properties ([#380](https://github.com/riok/mapperly/issues/380)) ([e5e2d1c](https://github.com/riok/mapperly/commit/e5e2d1c41ac265d4d06678c6ccf052bc343437e5)) * insert a cast to idictionary when an explicit setter is present ([#341](https://github.com/riok/mapperly/issues/341)) ([20f6f06](https://github.com/riok/mapperly/commit/20f6f0623b6d0735167560c9764a54d24598b861)) * prevent crash when object to object mapping ([#340](https://github.com/riok/mapperly/issues/340)) ([b5f4559](https://github.com/riok/mapperly/commit/b5f4559cc0547662e7080323c86e9f4ac68168e7)) ### Features * add EnsureCapacity method generation ([#312](https://github.com/riok/mapperly/issues/312)) ([c166a3f](https://github.com/riok/mapperly/commit/c166a3f17fd56b95f5b37638b08ab45dcc0c51a1)) * add EnsureCapacity to dctionary foreach loops ([#361](https://github.com/riok/mapperly/issues/361)) ([685d6ee](https://github.com/riok/mapperly/commit/685d6ee1e30c753bffa26ffeb5f066c495ea08e7)) * add mapping to immutable sequences ([#305](https://github.com/riok/mapperly/issues/305)) ([8c8a338](https://github.com/riok/mapperly/commit/8c8a338ee6707a33716a3e53d56b6642d77a7393)) * add queue and stack mapping ([#297](https://github.com/riok/mapperly/issues/297)) ([5040bf5](https://github.com/riok/mapperly/commit/5040bf516ba636292c4269500ff52c7f3254ca13)) * add support fot and ([#351](https://github.com/riok/mapperly/issues/351)) ([587abbc](https://github.com/riok/mapperly/commit/587abbc00560da242d0cd117e85117d0ca1f547a)) * queryable support for user implemented mappings ([#348](https://github.com/riok/mapperly/issues/348)) ([a58f56f](https://github.com/riok/mapperly/commit/a58f56f5305034d53041226aab92ad338fb34456)) * support fields ([d2fe807](https://github.com/riok/mapperly/commit/d2fe8074d47f5ce4fe0f0fe4d922383c3ff0109f)) * support immutable interfaced target types ([#365](https://github.com/riok/mapperly/issues/365)) ([fea8aa3](https://github.com/riok/mapperly/commit/fea8aa396d4b5f53a896f4236e2fb438731b1599)) * Support IQueryable projection mappings ([#287](https://github.com/riok/mapperly/issues/287)) ([c2a338f](https://github.com/riok/mapperly/commit/c2a338fa91ca8bfc761d20ac8ceb9a553dc45846)) * support mappers nested in classes ([#354](https://github.com/riok/mapperly/issues/354)) ([80a193a](https://github.com/riok/mapperly/commit/80a193ac8ca6e073c3b320d8b148a58c8ee6c68f)) * use IEnumerable constructors where possible ([#342](https://github.com/riok/mapperly/issues/342)) ([74d0b52](https://github.com/riok/mapperly/commit/74d0b52af6e62bd7ffe1e7fe85bea335736640de)) * use instead of ([#327](https://github.com/riok/mapperly/issues/327)) ([3b9c2f9](https://github.com/riok/mapperly/commit/3b9c2f9cb0e3fe4e969d4f2991135f2e5aab00d8))

.NET Standard 2.0

  • No dependencies.

Version Downloads Last updated
4.2.1 3 04/28/2025
4.2.1-next.2 1 04/25/2025
4.2.1-next.1 1 04/25/2025
4.2.1-next.0 5 04/14/2025
4.2.0 7 03/31/2025
4.2.0-next.2 7 03/23/2025
4.2.0-next.1 8 02/21/2025
4.2.0-next.0 8 01/26/2025
4.1.1 16 11/23/2024
4.1.1-next.0 16 11/07/2024
4.1.0 15 10/31/2024
4.1.0-next.3 14 10/31/2024
4.1.0-next.2 14 10/26/2024
4.1.0-next.1 15 10/16/2024
4.1.0-next.0 20 10/11/2024
4.0.0 17 10/11/2024
4.0.0-next.4 14 10/02/2024
4.0.0-next.3 20 08/17/2024
4.0.0-next.2 22 08/12/2024
4.0.0-next.1 21 07/01/2024
3.6.0 2,000 06/19/2024
3.6.0-next.2 24 06/06/2024
3.6.0-next.1 24 05/03/2024
3.5.1 24 04/23/2024
3.5.1-next.2 22 04/19/2024
3.5.1-next.1 22 04/09/2024
3.5.0 24 04/05/2024
3.5.0-next.4 24 03/27/2024
3.5.0-next.3 25 03/18/2024
3.5.0-next.2 21 03/16/2024
3.5.0-next.1 23 03/10/2024
3.4.0 22 03/01/2024
3.4.0-next.5 21 02/28/2024
3.4.0-next.4 21 02/19/2024
3.4.0-next.3 26 02/13/2024
3.4.0-next.2 26 01/12/2024
3.4.0-next.1 24 01/12/2024
3.3.1-next.1 27 12/21/2023
3.3.0 1,985 12/16/2023
3.3.0-next.6 27 12/10/2023
3.3.0-next.5 24 12/06/2023
3.3.0-next.4 24 12/06/2023
3.3.0-next.3 26 12/06/2023
3.3.0-next.2 24 10/26/2023
3.3.0-next.1 21 10/22/2023
3.2.0 25 09/19/2023
3.2.0-next.4 26 09/25/2023
3.2.0-next.3 26 09/12/2023
3.2.0-next.2 26 09/23/2023
3.2.0-next.1 24 09/03/2023
3.1.0 31 08/26/2023
3.1.0-next.2 26 08/23/2023
3.1.0-next.1 27 08/16/2023
3.0.0 27 08/16/2023
3.0.0-next.1 29 08/17/2023
2.9.0-next.4 25 08/06/2023
2.9.0-next.3 29 08/10/2023
2.9.0-next.2 24 07/05/2023
2.9.0-next.1 24 07/05/2023
2.8.0 28 07/05/2023
2.8.0-next.2 28 07/06/2023
2.8.0-next.1 492 04/13/2023
2.7.1-next.1 28 07/10/2023
2.7.0 29 07/08/2023
2.7.0-next.2 26 07/07/2023
2.7.0-next.1 23 07/07/2023
2.6.0 24 07/05/2023
2.6.0-next.4 25 07/04/2023
2.6.0-next.3 23 07/08/2023
2.6.0-next.2 27 07/07/2023
2.6.0-next.1 28 07/07/2023
2.5.0 30 06/27/2023
2.5.0-next.2 25 07/09/2023
2.5.0-next.1 28 07/06/2023
2.4.1-next.1 26 07/07/2023
2.4.0 26 07/05/2023
2.3.3 28 07/11/2023
2.3.2 27 07/07/2023
2.3.1 31 07/06/2023
2.3.0 31 07/05/2023
2.2.1 32 07/06/2023
2.2.0 27 07/04/2023
2.1.0 26 07/03/2023
2.0.0 28 07/17/2023