Riok.Mapperly
2.7.0
See the version list below for details.
dotnet add package Riok.Mapperly --version 2.7.0
NuGet\Install-Package Riok.Mapperly -Version 2.7.0
<PackageReference Include="Riok.Mapperly" Version="2.7.0" />
paket add Riok.Mapperly --version 2.7.0
#r "nuget: Riok.Mapperly, 2.7.0"
// Install Riok.Mapperly as a Cake Addin
#addin nuget:?package=Riok.Mapperly&version=2.7.0
// Install Riok.Mapperly as a Cake Tool
#tool nuget:?package=Riok.Mapperly&version=2.7.0
Mapperly
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 | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Riok.Mapperly:
Package | Downloads |
---|---|
Umbrella.Utilities.Mapping.Mapperly
This package contains Mapperly implementations of the Umbrella.Utilities.Mapping.Abstractions interfaces. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Riok.Mapperly:
Repository | Stars |
---|---|
martinothamar/Mediator
A high performance implementation of Mediator pattern in .NET using source generators.
|
Version | Downloads | Last updated |
---|---|---|
2.8.0-next.1 | 87 | 3/23/2023 |
2.7.1-next.1 | 389 | 3/17/2023 |
2.7.0 | 1,370 | 3/13/2023 |
2.7.0-next.2 | 341 | 1/26/2023 |
2.7.0-next.1 | 537 | 1/23/2023 |
2.6.0 | 14,143 | 1/12/2023 |
2.6.0-next.4 | 54 | 1/11/2023 |
2.6.0-next.3 | 100 | 1/9/2023 |
2.6.0-next.2 | 227 | 12/14/2022 |
2.6.0-next.1 | 502 | 12/12/2022 |
2.5.0 | 31,544 | 10/12/2022 |
2.5.0-next.2 | 235 | 9/28/2022 |
2.5.0-next.1 | 124 | 9/19/2022 |
2.4.1-next.1 | 90 | 9/16/2022 |
2.4.0 | 7,373 | 9/8/2022 |
2.3.3 | 2,147 | 8/10/2022 |
2.3.2 | 300 | 8/9/2022 |
2.3.1 | 37,488 | 5/31/2022 |
2.3.0 | 1,769 | 5/16/2022 |
2.2.1 | 2,909 | 4/6/2022 |
2.2.0 | 614 | 3/15/2022 |
2.1.0 | 460 | 2/28/2022 |
2.0.0 | 326 | 2/21/2022 |
# [2.7.0](https://github.com/riok/mapperly/compare/v2.6.0...v2.7.0) (2023-03-13)
### Bug Fixes
* do not map from indexed properties ([#232](https://github.com/riok/mapperly/issues/232)) ([8f0c08d](https://github.com/riok/mapperly/commit/8f0c08d9a3b2620b25556cde98ddd0d82f4635e4))
* improve enum mapping runtime exception ([#230](https://github.com/riok/mapperly/issues/230)) ([7a6b90b](https://github.com/riok/mapperly/commit/7a6b90bc954237c4b48adcd17bd860f3b91bd16a))
* register output as implementation source output ([#246](https://github.com/riok/mapperly/issues/246)) ([0eccd4d](https://github.com/riok/mapperly/commit/0eccd4d83c9e0bc0a02879832bf8ea6eca7c42b9)), closes [#72](https://github.com/riok/mapperly/issues/72)
* resolve user defined mappings for init properties with correct nullability ([#257](https://github.com/riok/mapperly/issues/257)) ([f18e424](https://github.com/riok/mapperly/commit/f18e424195eb0137c2c7a3df56cf9aaf3acd141f))
* support mapping to target readonly collections ([#252](https://github.com/riok/mapperly/issues/252)) ([8fa4116](https://github.com/riok/mapperly/commit/8fa4116f7f121bfe392b9aaa64aa0feb496747e2))
### Features
* constructor mapping support for MapProperty attribute ([#239](https://github.com/riok/mapperly/issues/239)) ([631fb34](https://github.com/riok/mapperly/commit/631fb346af74add9f3f924866912cd0b01e1c8ff))
* datetime to dateonly and timeonly mapping ([#253](https://github.com/riok/mapperly/issues/253)) ([c40108d](https://github.com/riok/mapperly/commit/c40108dbb254869d2e363fb7382eb94845fd04fc))
* support IList<T>, List<T> and IReadOnlyList<T> targets ([#248](https://github.com/riok/mapperly/issues/248)) ([fcaf5a5](https://github.com/riok/mapperly/commit/fcaf5a5ec29f3ea1f0196d3c1bcee21927075aaf))
* support roslyn 4.5 ([#220](https://github.com/riok/mapperly/issues/220)) ([56c5aca](https://github.com/riok/mapperly/commit/56c5aca96f83f878f4c62871e12ebc4c4aa58e6a))