Riok.Mapperly 3.3.0

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.

No packages depend on Riok.Mapperly.

# [3.3.0](https://github.com/riok/mapperly/compare/v3.2.0...v3.3.0) (2023-12-12) ### Bug Fixes * escape method parameters with reserved keywords ([#756](https://github.com/riok/mapperly/issues/756)) ([8f7528a](https://github.com/riok/mapperly/commit/8f7528a8b60fc7ffc3a3378e46ba48d88f54ab9b)) * extension method parameters for existing target mappings ([#923](https://github.com/riok/mapperly/issues/923)) ([86408ce](https://github.com/riok/mapperly/commit/86408ce0e21d5cef207c3df003e54313d992373d)) * improve location of reported diagnostics ([#937](https://github.com/riok/mapperly/issues/937)) ([980ac3e](https://github.com/riok/mapperly/commit/980ac3e730e497e5f6b7bc169d5d5ff3e9ecd07f)) * obsolete constructors should have the last priority whlie matching constructors (regression) ([#898](https://github.com/riok/mapperly/issues/898)) ([20b7da6](https://github.com/riok/mapperly/commit/20b7da64c11ebb267ddf25bc84a4419b9dbf5d49)) * remove unnecessary null conditional access in conditions of property mappings ([#788](https://github.com/riok/mapperly/issues/788)) ([c4eed62](https://github.com/riok/mapperly/commit/c4eed62787fdac37fda5b5b2cdc2e17625f79a60)) * resolve correct mapper defaults for roslyn versions <= 4.4 ([#958](https://github.com/riok/mapperly/issues/958)) ([14a4ed3](https://github.com/riok/mapperly/commit/14a4ed3e59c571f200b886a9839bba42631965e1)) * Respect AllowNullPropertyAssignment correctly when mapping code is not a direct assignment ([#939](https://github.com/riok/mapperly/issues/939)) ([cac2f2e](https://github.com/riok/mapperly/commit/cac2f2e74848ef418e8b670b3fe098a06710da1b)) * when resolving constructors allow a non-nullable value type to be assigned to a nullable value type ([#938](https://github.com/riok/mapperly/issues/938)) ([6e08f8e](https://github.com/riok/mapperly/commit/6e08f8e0cca258687d2f3c7751e80359629580d3)) ### Features * add diagnostic for nested ignores ([#818](https://github.com/riok/mapperly/issues/818)) ([0f61698](https://github.com/riok/mapperly/commit/0f61698d566030bf88191bd9887ab23ff8de7cde)) * add IncludedMembers configuration option and support private member mapping ([c0ed6eb](https://github.com/riok/mapperly/commit/c0ed6ebea3acc3123151d0ce4e6d733d52ec0ed2)) * Add option to specify the format provider or culture of a property ([#929](https://github.com/riok/mapperly/issues/929)) ([42d3e26](https://github.com/riok/mapperly/commit/42d3e26ae3ecb0ee7d904ecb148c471c1d659c52)) * Add option to specify the string format of a property ([#921](https://github.com/riok/mapperly/issues/921)) ([236a46f](https://github.com/riok/mapperly/commit/236a46f0cea32c1cf6c3288e752204386e40e6e8)) * add strict mapping ([#700](https://github.com/riok/mapperly/issues/700)) ([9d6c21a](https://github.com/riok/mapperly/commit/9d6c21ae36bbafd75c3b1bde363e691b7db72a4b)) * case-insensitive MapProperty configurations matching for constructor parameters ([#957](https://github.com/riok/mapperly/issues/957)) ([b9db799](https://github.com/riok/mapperly/commit/b9db799535c05335f0cf592a1f4335d882a9e836)) * fix incorrect when is used ([#933](https://github.com/riok/mapperly/issues/933)) ([b60441a](https://github.com/riok/mapperly/commit/b60441a265126dee63c6e1518cea61068006e90f)) * improve ToString handling and use simplest overloads available ([#950](https://github.com/riok/mapperly/issues/950)) ([574cef7](https://github.com/riok/mapperly/commit/574cef72ceb81cebe6351633ba96b06fb56bf0b5)) * support derived type mappings for existing target objects ([918f59d](https://github.com/riok/mapperly/commit/918f59d1d8a19e1ee791a5b6fd36f3a5bc2edb3a)) * support static mapping methods in non-static mappers ([#681](https://github.com/riok/mapperly/issues/681)) ([1724124](https://github.com/riok/mapperly/commit/1724124aac491493c461f12bfd5873b6de11a09b)) * use constructor for synthetic mappings ([#755](https://github.com/riok/mapperly/issues/755)) ([1bc7bdd](https://github.com/riok/mapperly/commit/1bc7bdd38da4c6d1282ca0d6c6d87e347ee5b8f3))

.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 6 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 21 08/12/2024
4.0.0-next.1 21 07/01/2024
3.6.0 1,999 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 21 04/09/2024
3.5.0 24 04/05/2024
3.5.0-next.4 23 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 21 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,984 12/16/2023
3.3.0-next.6 27 12/10/2023
3.3.0-next.5 23 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 26 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 28 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 491 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 27 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