Riok.Mapperly 3.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Riok.Mapperly --version 3.0.0
NuGet\Install-Package Riok.Mapperly -Version 3.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Riok.Mapperly" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Riok.Mapperly --version 3.0.0
#r "nuget: Riok.Mapperly, 3.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Riok.Mapperly as a Cake Addin
#addin nuget:?package=Riok.Mapperly&version=3.0.0

// Install Riok.Mapperly as a Cake Tool
#tool nuget:?package=Riok.Mapperly&version=3.0.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.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (11)

Showing the top 5 NuGet packages that depend on Riok.Mapperly:

Package Downloads
Fanzoo.Kernel The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

An opinionated framework for building scalable web applications.

Indice.Hive.Core

Package Description

Eternet.AspNetCore.DocumentDb.Crud The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

AspNet Core DocumentDb CRUD framework using Marten for Document DB and Events Store

BeamOS.Common.Api

Package Description

BeamOS.PhysicalModel.Application

Package Description

GitHub repositories (7)

Showing the top 5 popular GitHub repositories that depend on Riok.Mapperly:

Repository Stars
riok/mapperly
A .NET source generator for generating object mappings. No runtime reflection.
martinothamar/Mediator
A high performance implementation of Mediator pattern in .NET using source generators.
bitfoundation/bitplatform
Build all of your apps using what you already know and love ❤️
velopack/velopack
Installer and automatic update framework for cross-platform desktop applications
PlexRipper/PlexRipper
The best cross-platform Plex media downloader there is! In active development and feedback is very welcome!
Version Downloads Last updated
3.5.1 4,789 4/23/2024
3.5.1-next.2 246 4/15/2024
3.5.1-next.1 166 4/9/2024
3.5.0 39,256 4/5/2024
3.5.0-next.4 612 3/27/2024
3.5.0-next.3 1,066 3/18/2024
3.5.0-next.2 1,463 3/11/2024
3.5.0-next.1 371 3/9/2024
3.4.0 145,592 2/23/2024
3.4.0-next.5 646 2/20/2024
3.4.0-next.4 835 2/16/2024
3.4.0-next.3 2,695 2/5/2024
3.4.0-next.2 9,285 1/10/2024
3.4.0-next.1 288 1/6/2024
3.3.1-next.1 2,577 12/18/2023
3.3.0 334,767 12/12/2023
3.3.0-next.6 792 12/6/2023
3.3.0-next.5 1,266 11/28/2023
3.3.0-next.4 1,298 11/22/2023
3.3.0-next.3 2,959 11/19/2023
3.3.0-next.2 2,537 10/26/2023
3.3.0-next.1 2,815 10/11/2023
3.2.0 426,281 9/18/2023
3.2.0-next.4 1,360 9/12/2023
3.2.0-next.3 438 9/11/2023
3.2.0-next.2 260 9/5/2023
3.2.0-next.1 449 8/29/2023
3.1.0 126,131 8/18/2023
3.1.0-next.2 91 8/18/2023
3.1.0-next.1 4,132 8/8/2023
3.0.0 31,037 8/7/2023
3.0.0-next.1 275 8/2/2023
2.9.0-next.4 4,637 7/26/2023
2.9.0-next.3 539 7/16/2023
2.9.0-next.2 4,954 6/13/2023
2.9.0-next.1 5,519 5/11/2023
2.8.0 450,795 4/27/2023
2.8.0-next.2 502 4/20/2023
2.8.0-next.1 14,498 3/23/2023
2.7.1-next.1 641 3/17/2023
2.7.0 131,904 3/13/2023
2.7.0-next.2 759 1/26/2023
2.7.0-next.1 591 1/23/2023
2.6.0 72,789 1/12/2023
2.6.0-next.4 100 1/11/2023
2.6.0-next.3 153 1/9/2023
2.6.0-next.2 279 12/14/2022
2.6.0-next.1 557 12/12/2022
2.5.0 73,427 10/12/2022
2.5.0-next.2 308 9/28/2022
2.5.0-next.1 203 9/19/2022
2.4.1-next.1 175 9/16/2022
2.4.0 14,923 9/8/2022
2.3.3 3,034 8/10/2022
2.3.2 863 8/9/2022
2.3.1 61,199 5/31/2022
2.3.0 2,365 5/16/2022
2.2.1 3,490 4/6/2022
2.2.0 1,196 3/15/2022
2.1.0 1,027 2/28/2022
2.0.0 924 2/21/2022

# [3.0.0](https://github.com/riok/mapperly/compare/v2.8.0...v3.0.0) (2023-08-07)


### Bug Fixes

*  is no longer treated as a member ([#575](https://github.com/riok/mapperly/issues/575)) ([b238481](https://github.com/riok/mapperly/commit/b23848167648b3dde900a6f241fb40a8d1563596))
* Add <auto-generated /> comment ([#496](https://github.com/riok/mapperly/issues/496)) ([b3e1657](https://github.com/riok/mapperly/commit/b3e1657325cfd65e6e678d841519c022a8bdf9a3))
* add private does not obscure test ([#554](https://github.com/riok/mapperly/issues/554)) ([f6d8d34](https://github.com/riok/mapperly/commit/f6d8d3440812deb6fe43574ebdf6a79e3797a8d9))
* allow reference handling for generic and runtime target type mapping methods ([#508](https://github.com/riok/mapperly/issues/508)) ([34b237f](https://github.com/riok/mapperly/commit/34b237fb44129fd7867a5f4fdda71872ded3aeff))
* clone array when deepcloning is enabled and target is an IEnumerable ([#431](https://github.com/riok/mapperly/issues/431)) ([082d877](https://github.com/riok/mapperly/commit/082d877e113378ec8d29b6928911ff4c398fe762))
* disable warning when iterating nullable array elements ([#592](https://github.com/riok/mapperly/issues/592)) ([8f37f44](https://github.com/riok/mapperly/commit/8f37f4401f51eb9c4f5fbcfb8424cbffe34fc9a8))
* exclude explicit casts when source type is object ([#400](https://github.com/riok/mapperly/issues/400)) ([3af9cc9](https://github.com/riok/mapperly/commit/3af9cc943a61e92dbc4dafcc956ce2bb51365825))
* existing dictionary and enumerable mapping should respect enabled conversion types ([#459](https://github.com/riok/mapperly/issues/459)) ([86f48a2](https://github.com/riok/mapperly/commit/86f48a2a152e637f46e188c4ee11f7d369f23230))
* generate nameof compatible member access ([#539](https://github.com/riok/mapperly/issues/539)) ([92673db](https://github.com/riok/mapperly/commit/92673dbfbb02d636b3de5dea6b024f93cb94c933))
* handle internal visibility correctly ([#597](https://github.com/riok/mapperly/issues/597)) ([5d4596a](https://github.com/riok/mapperly/commit/5d4596a2e963032b5d61be627f99581649868368))
* ignore user implemented generic methods ([#423](https://github.com/riok/mapperly/issues/423)) ([408d03f](https://github.com/riok/mapperly/commit/408d03fdc13a19ef254faa253e7745b452524068))
* improve performance for member resolution ([#603](https://github.com/riok/mapperly/issues/603)) ([641c1bf](https://github.com/riok/mapperly/commit/641c1bf594f751c0aaf30aa7403e1fc862cd37ef))
* incorrect initialization for nullable nested memberpath unflattening ([#591](https://github.com/riok/mapperly/issues/591)) ([9b74e8f](https://github.com/riok/mapperly/commit/9b74e8fb025809035a5dda0d6d91fb34f5f6d6ef))
* lambdas should use correct scopes to generate names ([#411](https://github.com/riok/mapperly/issues/411)) ([e5d9bb2](https://github.com/riok/mapperly/commit/e5d9bb2bf215fad916bdfbfa7d11366903256c8d))
* make all attributes sealed ([#614](https://github.com/riok/mapperly/issues/614)) ([24614c0](https://github.com/riok/mapperly/commit/24614c0f9b0350bf1af1a42a6049a316947850d0))
* map existing target sets correct ([#500](https://github.com/riok/mapperly/issues/500)) ([38e6556](https://github.com/riok/mapperly/commit/38e655630453b0dfe98fa76d73e5de4845eba405))
* only use instance constructors to create new object instances ([#458](https://github.com/riok/mapperly/issues/458)) ([848fb45](https://github.com/riok/mapperly/commit/848fb45c5d81ca868b2818a2496738eda57a1d25))
* prevent ctormapping using inaccessible constructors ([#456](https://github.com/riok/mapperly/issues/456)) ([125742e](https://github.com/riok/mapperly/commit/125742e799fb4ed166750ddc955750f5ab50f0cd))
* prevent duplicates attributes and base types for nested mappers ([#544](https://github.com/riok/mapperly/issues/544)) ([44667c8](https://github.com/riok/mapperly/commit/44667c8576d404bca9ce2696b90746d5d4e97a16))
* prevent generation of empty if not null statements ([#576](https://github.com/riok/mapperly/issues/576)) ([8cbeff1](https://github.com/riok/mapperly/commit/8cbeff1dbc7761f065d6ec75f5dbd8b05c713f87))
* prevent mapping backing field ([#608](https://github.com/riok/mapperly/issues/608)) ([d768dbb](https://github.com/riok/mapperly/commit/d768dbb4f74a889cf91784721a2b2a257744386c))
* prevent throw throw being generated. ([#415](https://github.com/riok/mapperly/issues/415)) ([3c41c84](https://github.com/riok/mapperly/commit/3c41c84991d68693cb34f349c33a6868e0987853))
* remove obsolete MapperIgnoreAttribute ([#611](https://github.com/riok/mapperly/issues/611)) ([c7a5099](https://github.com/riok/mapperly/commit/c7a509966a714dbb5bce92306798e1fe0196de60))
* required/init properties not using PropertyNameMappingStrategy ([#505](https://github.com/riok/mapperly/issues/505)) ([#556](https://github.com/riok/mapperly/issues/556)) ([564a43e](https://github.com/riok/mapperly/commit/564a43e2f62d458ebad32fc33c943f376c571c4e))
* seal all configuration attributes ([#403](https://github.com/riok/mapperly/issues/403)) ([cb837e0](https://github.com/riok/mapperly/commit/cb837e0166fa37eef682d74e967563737fca757d))
* support queryable projection mappings for derived type mappings ([#412](https://github.com/riok/mapperly/issues/412)) ([98a44a0](https://github.com/riok/mapperly/commit/98a44a029a58dd5024d6a8a2740df450a3d80bc5))
* throw NullReferenceException for element access ([#414](https://github.com/riok/mapperly/issues/414)) ([78b2736](https://github.com/riok/mapperly/commit/78b2736f0f30ca0b8fbd259e60f68941e7d0681b))
* update IsImmutable to identify valid types on framework ([#388](https://github.com/riok/mapperly/issues/388)) ([b9a1f19](https://github.com/riok/mapperly/commit/b9a1f1911637526c4ff3afa3ddc0841b6b417041))
* use ToList/ToArray to clone enumerable interfaces ([#432](https://github.com/riok/mapperly/issues/432)) ([f947cbf](https://github.com/riok/mapperly/commit/f947cbf868cc4a9ccdd7be2e4d55027229d2d3d7))


### Features

* accept destination type as mapping method parameter ([#398](https://github.com/riok/mapperly/issues/398)) ([b17f666](https://github.com/riok/mapperly/commit/b17f666eff839283e5d8976e52f11df307939840))
* add AllowNullPropertyAssignment option to disable assigning null values to nullable properties ([#584](https://github.com/riok/mapperly/issues/584)) ([0ccc734](https://github.com/riok/mapperly/commit/0ccc734a0f1cffc45538618904c910f4acb8c439))
* add IgnoreObsoleteMembers ([#392](https://github.com/riok/mapperly/issues/392)) ([def10cf](https://github.com/riok/mapperly/commit/def10cf187f14f5b8bcc3d4689fe86266deea4fb))
* add option to ignore enum values ([#536](https://github.com/riok/mapperly/issues/536)) ([3e2a2c8](https://github.com/riok/mapperly/commit/3e2a2c891440c0101ce00b5a391edbc9d93b2bfe))
* add support for  and  mappings ([#425](https://github.com/riok/mapperly/issues/425)) ([ac254ca](https://github.com/riok/mapperly/commit/ac254ca2ee276d26736e4ad406cfe04f534ff6a9))
* add support for user defined generic mapping methods ([#461](https://github.com/riok/mapperly/issues/461)) ([ddbc516](https://github.com/riok/mapperly/commit/ddbc5169a3afe4d290c58b5e05c6e4b749a6f30d))
* add tuple mapping support ([#467](https://github.com/riok/mapperly/issues/467)) ([208e8b4](https://github.com/riok/mapperly/commit/208e8b49d92d0e4d1dd6b1e3ffc09eea73b4adb0))
* Added MapEnumValueAttribute and support for explicit named enum value mapping ([#468](https://github.com/riok/mapperly/issues/468)) ([64e6c9d](https://github.com/riok/mapperly/commit/64e6c9d58862ea6beb88d11488a824cd5425220e))
* added source generator benchmark ([#419](https://github.com/riok/mapperly/issues/419)) ([b6836b2](https://github.com/riok/mapperly/commit/b6836b277e23a0028f6a762880be2c9efe4bff20))
* cache attribute symbols ([#478](https://github.com/riok/mapperly/issues/478)) ([fbe8ba1](https://github.com/riok/mapperly/commit/fbe8ba154efa5cd727affa5280bdc24dfd62a6aa))
* diagnostic if an incompatible language version is used ([#566](https://github.com/riok/mapperly/issues/566)) ([38332a6](https://github.com/riok/mapperly/commit/38332a68155d42570a93cd43d4e21f9610a4690b))
* directly assign System.Uri and System.Version when deep cloning ([#440](https://github.com/riok/mapperly/issues/440)) ([c845b43](https://github.com/riok/mapperly/commit/c845b43bea2651b9e67b1bc7dae99c5320da60b1))
* explicit enum mappings for byValue enum mappings ([#489](https://github.com/riok/mapperly/issues/489)) ([029dae2](https://github.com/riok/mapperly/commit/029dae28de90722f0bf55f7aabed47027db5ed83))
* ISet and IReadOnlySet support ([#502](https://github.com/riok/mapperly/issues/502)) ([9550ae4](https://github.com/riok/mapperly/commit/9550ae4591fd27652f4ff0aa403f2f1a38e41033))
* Map all accessible members by default ([#597](https://github.com/riok/mapperly/issues/597)) ([#612](https://github.com/riok/mapperly/issues/612)) ([3d2ed69](https://github.com/riok/mapperly/commit/3d2ed699119da04213d8e3303fc56471e411a770))
* optimize BuildMemberPathCandidates performance ([#480](https://github.com/riok/mapperly/issues/480)) ([34b926b](https://github.com/riok/mapperly/commit/34b926b456b74a7c3c36c11be29c271547ddba6f))
* optimize enum ByValueCheckDefined strategy and support flags ([#510](https://github.com/riok/mapperly/issues/510)) ([602c79d](https://github.com/riok/mapperly/commit/602c79dadbadd3f03a335a3bde2279950855f6cf))
* support derived type configuration inheritance ([#509](https://github.com/riok/mapperly/issues/509)) ([66124f8](https://github.com/riok/mapperly/commit/66124f8509f278f9e62428916db7cbafbcea5716))
* support derived type mappings ([#366](https://github.com/riok/mapperly/issues/366)) ([11995f0](https://github.com/riok/mapperly/commit/11995f0dddc8ebf35fd29c8f7837744d26855520))
* Support enum mapping is defined check and fallback values ([#491](https://github.com/riok/mapperly/issues/491)) ([f0065c8](https://github.com/riok/mapperly/commit/f0065c8c5e9fa4b3a26951e733c0d06bb5501816))
* support for strict enum mappings ([#356](https://github.com/riok/mapperly/issues/356)) ([b13d364](https://github.com/riok/mapperly/commit/b13d36453a51db9adcf49c76edc169c0c64b6919))


### BREAKING CHANGES

* mark all attributes as sealed
* Include accessible internal and private members in mappings
* Obsolete MapperIgnoreAttribute is removed and needs to be replaced with MapperIgnoreTargetAttribute