wakiter.AutoMapper.Extensions 0.0.5

dotnet add package wakiter.AutoMapper.Extensions --version 0.0.5
                    
NuGet\Install-Package wakiter.AutoMapper.Extensions -Version 0.0.5
                    
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="wakiter.AutoMapper.Extensions" Version="0.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="wakiter.AutoMapper.Extensions" Version="0.0.5" />
                    
Directory.Packages.props
<PackageReference Include="wakiter.AutoMapper.Extensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add wakiter.AutoMapper.Extensions --version 0.0.5
                    
#r "nuget: wakiter.AutoMapper.Extensions, 0.0.5"
                    
#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.
#addin nuget:?package=wakiter.AutoMapper.Extensions&version=0.0.5
                    
Install wakiter.AutoMapper.Extensions as a Cake Addin
#tool nuget:?package=wakiter.AutoMapper.Extensions&version=0.0.5
                    
Install wakiter.AutoMapper.Extensions as a Cake Tool

AutoMapper.Extensions

An extension library for AutoMapper that brings back automatic mapping creation, ignoring missing constructor parameters (default values for types are passed), strongly-typed mappings for constructor parameters to lessen code changes and possible issues

Project Description

AutoMapper is a brilliant and powerfull tool. But even though, it has its own isseus and missing functionalities. If you want to follow zero friction theorem, AutoMapper can bring you closer to it. With creation of automated mapping, ignoring missing constructor parameters and strongly-typed constructor parameters (instead of using string value) you can create a better, more robust and requiring less maintenance code.

Overview

This library was intended to restore automatic creation of AutoMapper mappings. If you have nested types, just use extension method .CreateAutoMap<TSource, TDestination>() or .CreateAutoMap(typeof(TSource), typeof(TDestination)) and all types used in those classes will be automatically mapped.

If you want to pass default type values for destination type constructor, use .CtorPassDefaultsForMissingParameters() or .CtorPassDefaultsForMissingParameters(typeof(TSource), typeof(TDestination)).

In case you want to pass a fixed value to a destination type parameter, then use .CtorMapParameter(x => x.Parameter, TValueInstance). The name of the parameter is taken from an appropriate property that is defined within the type. The name must match, however, this match is case-insensitive.

You can as well do a normal mapping for constructor parameters in AutoMapper style, but without need to specify name of the parameter manually. To achieve that use the following method .CtorMapParameter(x => x.Parameter, cfg => cfg.MapFrom((...))). Name of the constructor parameter is calculated and matched automatically using case-insensitive comparison.

Example:


public sealed class ConverterFromSourceToDestination
{
	private readonly IMapper _mapper = new MapperConfiguration(cfg => 
	{
		cfg
			.CreateAutoMap<TSource, TDestination>() //this will create a map for those two mentioned types and all types they use for properties
			.CtorPassDefaultsForMissingParameters() //this will pass default parameters for TDestination constructor  and descendants if combined with CreateAutoMap
			.CtorMapParameter(x => x.Parameter, fixedValue) //this will pass an object with name fixedValue as a parameter for constructor parameter with a name that matches `Parameter`
			.CtorMapParameter(x => x.OtherParameter, paramCfg => paramCfg.MapFrom((...))); //this will allow you to create custom configuration for constructor parameter but using strongly-typed way and not magic strings
	});
}

Versioning

AutoMapper.Extensions uses Semantic Versioning 2.0.0 for the public releases (published to the nuget.org).

Additional resources

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
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
0.0.5 11,697 1/29/2023
0.0.4 19,137 3/9/2022
0.0.3 448 3/5/2022