NeatMapper.Transitive 5.0.0

dotnet add package NeatMapper.Transitive --version 5.0.0                
NuGet\Install-Package NeatMapper.Transitive -Version 5.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="NeatMapper.Transitive" Version="5.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NeatMapper.Transitive --version 5.0.0                
#r "nuget: NeatMapper.Transitive, 5.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 NeatMapper.Transitive as a Cake Addin
#addin nuget:?package=NeatMapper.Transitive&version=5.0.0

// Install NeatMapper.Transitive as a Cake Tool
#tool nuget:?package=NeatMapper.Transitive&version=5.0.0                

.NEaT Mapper - Transitive

NuGet

What is this package

Transitive maps for NeatMapper.

Allows mapping types by automatically chaining maps together, eg: If you have maps for types A → B and B → C you can also map A → C by chaining A → B → C, supports normal maps and asynchronous ones, also supports collections.

How to install

You can find all the other packages on Nuget https://www.nuget.org/profiles/xriuk

You can install this package directly from Nuget https://www.nuget.org/packages/NeatMapper.Transitive

How to use

While configuring your services simply add

services.AddNeatMapper();

services.AddNeatMapperTransitive();

Then define your maps

public class MyMaps :
    INewMap<Product, ProductDto1>,
    INewMap<ProductDto1, ProductDto2>
{
    ProductDto1? INewMap<Product, ProductDto1>.Map(Product? source, MappingContext context){
        if(source == null)
            return null;
        else{
            return new ProductDto1{
                Code = source.Code,
                ...
            };
        }
    }

    ProductDto2? INewMap<ProductDto1, ProductDto2>.Map(ProductDto1? source, MappingContext context){
        if(source == null)
            return null;
        else{
            return new ProductDto2{
                Code = source.Code,
                ...
            };
        }
    }
}

And you are ready to map your entities

var mapper = serviceProvider.GetRequiredService<IMapper>();


Product product = ...;

// Transitively maps Product to ProductDto1 and then to ProductDto2
ProductDto2 productDto2 = mapper.Map<ProductDto2>(product);

Advanced options

Find more advanced use cases in the website or in the extended tests project.

License

Read the license here

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 is compatible.  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 netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net47 is compatible.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.0 81 11/3/2024