Riok.Mapperly 3.4.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.4.0](https://github.com/riok/mapperly/compare/v3.3.0...v3.4.0) (2024-02-23) ### Bug Fixes * correctly annotate nullable generics in disabled nullable contexts ([#1020](https://github.com/riok/mapperly/issues/1020)) ([d35c52d](https://github.com/riok/mapperly/commit/d35c52ddff74c4d357168d119f41d487953869d8)) * do not resolve existing one sideded loose nullable property mappings ([#1090](https://github.com/riok/mapperly/issues/1090)) ([7998720](https://github.com/riok/mapperly/commit/79987209b7922b92f96f8888a404e56db1b87569)) * don't diagnostic for constructor mappings when no instance can be created but none is needed anyway ([450d7ca](https://github.com/riok/mapperly/commit/450d7ca602a48ac39b6a2fb9567b6bdefcd4315e)) * generate enumerable mapping methods with interface parameters instead of concrete types to reduce generated methods ([#1088](https://github.com/riok/mapperly/issues/1088)) ([66752cf](https://github.com/riok/mapperly/commit/66752cfa000854a0ca9a1836d1a2abb4de4b1251)) * generate generic mapping only for matching source / target types if non-generic ([#1000](https://github.com/riok/mapperly/issues/1000)) ([9a2916f](https://github.com/riok/mapperly/commit/9a2916fc102b499078298771486ede1672af43d4)) * handle nullable correctly in nullable disabled contexts for generics and arrays ([#1029](https://github.com/riok/mapperly/issues/1029)) ([132b8cc](https://github.com/riok/mapperly/commit/132b8ccc9d1d755415c6f6b17fcab20e286fd77f)) * prevent collection mapping from using invalid length property ([#1108](https://github.com/riok/mapperly/issues/1108)) ([216f791](https://github.com/riok/mapperly/commit/216f791c786948b3f89ba20e19c53e04cd239628)) * prevent crash for delegate fields when deep mapping is enabled ([#1058](https://github.com/riok/mapperly/issues/1058)) ([88dd1ff](https://github.com/riok/mapperly/commit/88dd1ff9e732b53fb79cfaf3ff7d0a5013fea5b4)) * remove Runtime suffix of MapperlyAbstractionsScope msbuild option ([#1049](https://github.com/riok/mapperly/issues/1049)) ([54b0eea](https://github.com/riok/mapperly/commit/54b0eea7169a82f277e031bd25b8f0de04c369b0)) * upgrade parameter nullability correctly ([#1057](https://github.com/riok/mapperly/issues/1057)) ([ad917ee](https://github.com/riok/mapperly/commit/ad917ee4f1a547cd3d61a6e32776b49572ce08d1)) * use correct argument types in user defined enumerable mappings with an array source parameter ([#1125](https://github.com/riok/mapperly/issues/1125)) ([8b14725](https://github.com/riok/mapperly/commit/8b14725a9635ad05efd893df9a2b86463f98996e)) ### Features * add option to prefer parameterised constructors ([#1061](https://github.com/riok/mapperly/issues/1061)) ([e606f93](https://github.com/riok/mapperly/commit/e606f936e6c2f403fd875912924a7d38a4bdb6dc)) * annotate all emitted methods and classes with GeneratedCodeAttribute. ([#1069](https://github.com/riok/mapperly/issues/1069)) ([374e6cb](https://github.com/riok/mapperly/commit/374e6cb59dff49af5f0b7ef74919c6235bc2ba84)) * remove runtime dependency ([#1027](https://github.com/riok/mapperly/issues/1027)) ([ca3ea5a](https://github.com/riok/mapperly/commit/ca3ea5a9152a8466608bb320951f3995cca13bf1))

.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 25 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