ELMapper.NET 8.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ELMapper.NET --version 8.0.2
                    
NuGet\Install-Package ELMapper.NET -Version 8.0.2
                    
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="ELMapper.NET" Version="8.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ELMapper.NET" Version="8.0.2" />
                    
Directory.Packages.props
<PackageReference Include="ELMapper.NET" />
                    
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 ELMapper.NET --version 8.0.2
                    
#r "nuget: ELMapper.NET, 8.0.2"
                    
#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.
#:package ELMapper.NET@8.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ELMapper.NET&version=8.0.2
                    
Install as a Cake Addin
#tool nuget:?package=ELMapper.NET&version=8.0.2
                    
Install as a Cake Tool

ELMapper.NET - the solution for automatic mapping of objects and collections

ELMapper.NET - the solution for automatic mapping of objects and collections. It is necessary to define at least some properties from the source class to the destination with the same names in the source class. The Mapper works in two ways (object-to-object mapping and collection-to-collection mapping) using that work in asynchronous and synchronous modes.

These are the generic extension methods used (the suffix Async is for asynchronous methods):

  • Task<T_Destination> MapObjectAsync<T_Source, T_Destination>(this T_Source objFrom, T_Destination? objTo=null)
  • T_Destination MapObject<T_Source, T_Destination>(this T_Source objFrom, T_Destination? objTo = null)
  • Task<IEnumerable<T_Destination>> MapIEnumerableAsync<T_Source, T_Destination>(this IEnumerable<T_Source> enumerableFrom, List<T_Destination>? listTo=null)
  • IEnumerable<T_Destination> MapIEnumerable<T_Source, T_Destination>(this IEnumerable<T_Source> enumerableFrom, List<T_Destination>? listTo = null)

Usage

Since the methods are extension methods, the source is the object from which we call the method itself, and it is also important to specify the types for the source and destination as in the method signatures above. Each method has an optional parameter to which we pass an object or a generic list (often the case is that we have a ViewModel object with properties that have already set values). The method's return type is the destination type as shown above, with the exception that for generic collections the return type is IEnumerable.

Below are examples of calling the methods where the source is BankEmployee and the destination is BankEmployeeVM:

Mapping collections without passing an optional parameter

await context.BankEmployees.ToList().MapIEnumerableAsync<BankEmployee, BankEmployeeVM>();

Collection mapping with optional parameter passing

List<BankEmployeeVM> destList

/* assumption that here we already have the property values ​​of the BankEmployeeVM class set, but that these properties are not on the source, so that we do not lose the property values ​​that are on the objects of the BankEmployeeVM class. */

context.BankEmployees.ToList().MapIEnumerable<BankEmployee, BankEmployeeVM>(destList);

Mapping object to object without passing an optional parameter

await context.BankEmployees.Where(x=>x.Id==id).FirstAsync().Result.MapObjectAsync<BankEmployee,BankEmployeeVM>()

Object-to-object mapping with optional parameter passing

BankEmployeeVM destObj

/* assumption that here we already have the property values ​​of the BankEmployeeVM class set, but that these properties are not on the source, so that we do not lose the property values ​​that are on the objects of the BankEmployeeVM class. */

await context.BankEmployees.Where(x=>x.Id==id).FirstAsync().Result.MapObjectAsync<BankEmployee,BankEmployeeVM>(destObj)

In addition to asynchronous methods, we also have synchronous ones, so we will give one example of object-to-object mapping (all synchronous methods are called in the same way - without the suffix Async as stated above in signatures)

context.BankEmployees.Where(x=>x.Id==id).First().MapObject<BankEmployee,BankEmployeeVM>();

Product Compatible and additional computed target framework versions.
.NET 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.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

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
8.1.1 100 4/23/2026
8.0.2 115 2/9/2026