Riok.Mapperly 3.5.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.5.0](https://github.com/riok/mapperly/compare/v3.4.0...v3.5.0) (2024-04-05) ### Bug Fixes * correctly assign null if target is nullable instead of throwing ([#1191](https://github.com/riok/mapperly/issues/1191)) ([f08b7b4](https://github.com/riok/mapperly/commit/f08b7b458ec035abbd683dc01cca312742e64eff)) * do not generalise enumerable dictionary value types ([#1155](https://github.com/riok/mapperly/issues/1155)) ([b4d5e74](https://github.com/riok/mapperly/commit/b4d5e74f428da7f8ac7d52bac07a4d6d47a0a9b9)) * Increase RMG060 default severity from info to warning ([#1173](https://github.com/riok/mapperly/issues/1173)) ([3cba05b](https://github.com/riok/mapperly/commit/3cba05b27b7ccb4c123bf7e07aacd8646f6cf5dc)) * map init only collection in existing target mapping correctly ([#1190](https://github.com/riok/mapperly/issues/1190)) ([c9b4b17](https://github.com/riok/mapperly/commit/c9b4b1771cbb138a4217c91dfe5cc490dd11aa99)) * resolve user mappings correctly when reference handling is enabled ([#1162](https://github.com/riok/mapperly/issues/1162)) ([d303198](https://github.com/riok/mapperly/commit/d303198d3e7bd748e0987ae658b7aa81c6f0934d)) ### Features * add diagnostic if no members are mapped ([#1129](https://github.com/riok/mapperly/issues/1129)) ([732cec4](https://github.com/riok/mapperly/commit/732cec449abc569d317b5e593388ada4a349a7f5)) * Add MapperIgnoreMemberAttribute to ignore members at declaration ([#1143](https://github.com/riok/mapperly/issues/1143)) ([ebce68e](https://github.com/riok/mapperly/commit/ebce68ed5653efc3d8a5df01acd91fdccf21fbfb)) * Add option to disable automatic discovery of user implemented mapping method and to include/exclude specific user implemented mapping methods ([#1070](https://github.com/riok/mapperly/issues/1070)) ([4e4937c](https://github.com/riok/mapperly/commit/4e4937c103af6a5f61f085862b089f15ee350ebf)) * allow property mappings to use specific conversion ([#1072](https://github.com/riok/mapperly/issues/1072)) ([61716b9](https://github.com/riok/mapperly/commit/61716b92121810cc27208058e411bba5a3b8eefc)) * allow usage of mappings in MapPropertyAttribute.Use which are attributed with UserMappingAttribute ([#1151](https://github.com/riok/mapperly/issues/1151)) ([1f0b3c5](https://github.com/riok/mapperly/commit/1f0b3c5d8e2dc8f2c6f424d4447f3e6d1353d8b8)) * allow user implemented mappings to be marked as default ([#1071](https://github.com/riok/mapperly/issues/1071)) ([79f60cd](https://github.com/riok/mapperly/commit/79f60cded4db1f3f154096946e793db9c8e8df8e)) * improve generated method names by including generic type names ([#1168](https://github.com/riok/mapperly/issues/1168)) ([fb482a0](https://github.com/riok/mapperly/commit/fb482a0f8578fd08ae45ebce36d4e0fd8c0fbc27)) * Inline user implemented queryable mapping expressions ([#1169](https://github.com/riok/mapperly/issues/1169)) ([530066f](https://github.com/riok/mapperly/commit/530066fbb925fe4bb8529babd77bd5b58a191f54)), closes [#953](https://github.com/riok/mapperly/issues/953) * report a diagnostic for invalid MapPropertyAttribute usages ([#1130](https://github.com/riok/mapperly/issues/1130)) ([b8b9e2a](https://github.com/riok/mapperly/commit/b8b9e2a013200dad884de2a36976771f76428d67)) * rework generic type matching ([#1199](https://github.com/riok/mapperly/issues/1199)) ([1e78844](https://github.com/riok/mapperly/commit/1e78844fbe1bbb47b14216f29ef08ea9de37a330)) * support required mapping strategies on enums ([#1073](https://github.com/riok/mapperly/issues/1073)) ([edc4933](https://github.com/riok/mapperly/commit/edc4933b720c3ce9910cfc6061ce0329e784a85b)) * validate usage of MapProperty attributes on enum and queryable mapping methods ([#1074](https://github.com/riok/mapperly/issues/1074)) ([fbe7894](https://github.com/riok/mapperly/commit/fbe7894be0691cd9b3e0449c2577fcad82661104))

.NET Standard 2.0

  • No dependencies.

Version Downloads Last updated
4.2.1 2 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 5 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 20 08/12/2024
4.0.0-next.1 20 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 23 05/03/2024
3.5.1 23 04/23/2024
3.5.1-next.2 22 04/19/2024
3.5.1-next.1 21 04/09/2024
3.5.0 23 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 25 02/13/2024
3.4.0-next.2 26 01/12/2024
3.4.0-next.1 23 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 25 09/25/2023
3.2.0-next.3 25 09/12/2023
3.2.0-next.2 26 09/23/2023
3.2.0-next.1 24 09/03/2023
3.1.0 29 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 27 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 27 07/10/2023
2.7.0 29 07/08/2023
2.7.0-next.2 25 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 25 07/05/2023
2.3.3 28 07/11/2023
2.3.2 27 07/07/2023
2.3.1 30 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 27 07/17/2023