Fluent.Unions.Mapster
1.1.0
dotnet add package Fluent.Unions.Mapster --version 1.1.0
NuGet\Install-Package Fluent.Unions.Mapster -Version 1.1.0
<PackageReference Include="Fluent.Unions.Mapster" Version="1.1.0" />
<PackageVersion Include="Fluent.Unions.Mapster" Version="1.1.0" />
<PackageReference Include="Fluent.Unions.Mapster" />
paket add Fluent.Unions.Mapster --version 1.1.0
#r "nuget: Fluent.Unions.Mapster, 1.1.0"
#:package Fluent.Unions.Mapster@1.1.0
#addin nuget:?package=Fluent.Unions.Mapster&version=1.1.0
#tool nuget:?package=Fluent.Unions.Mapster&version=1.1.0
![]()
Fluent.Unions.Mapster
Maps Option<T> properties with Mapster: T? to Option<T>, Option<T> to T?, and Option<TSource> to Option<TDestination>. It builds on Fluent.Unions.
Installation
dotnet add package Fluent.Unions.Mapster
Usage
Register the rules once, on TypeAdapterConfig.GlobalSettings or on your own config.
using Mapster;
using Fluent.Unions.Mapster;
TypeAdapterConfig.GlobalSettings.AddFluentUnions();
var dto = person.Adapt<PersonDto>(); // string? Nickname -> Option<string> Nickname
var back = dto.Adapt<Person>(); // None -> null
None and null map to each other, and the element is mapped with your configured rules. Option<int> to int gives 0 for None.
Mapster.Tool code generation is not supported for Option<T>: the rules use the runtime configuration, which the generator cannot turn into source.
Documentation
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Fluent.Unions (>= 1.1.0)
- Mapster (>= 10.0.14)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.