Mapster 3.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Mapster --version 3.2.0                
NuGet\Install-Package Mapster -Version 3.2.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="Mapster" Version="3.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mapster --version 3.2.0                
#r "nuget: Mapster, 3.2.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 Mapster as a Cake Addin
#addin nuget:?package=Mapster&version=3.2.0

// Install Mapster as a Cake Tool
#tool nuget:?package=Mapster&version=3.2.0                

Mapster Icon

Mapster - The Mapper of Your Domain

Writing mapping method is machine job. Do not waste your time, let Mapster do it.

Get it

PM> Install-Package Mapster

Basic usage

Mapping to a new object

Mapster creates the destination object and maps values to it.

var destObject = sourceObject.Adapt<TDestination>();
Mapping to an existing object

You make the object, Mapster maps to the object.

TDestination destObject = new TDestination();
destObject = sourceObject.Adapt(destObject);
Queryable Extensions

Mapster also provides extensions to map queryables.

using (MyDbContext context = new MyDbContext())
{
    // Build a Select Expression from DTO
    var destinations = context.Sources.ProjectToType<Destination>().ToList();

    // Versus creating by hand:
    var destinations = context.Sources.Select(c => new Destination(){
        Id = p.Id,
        Name = p.Name,
        Surname = p.Surname,
        ....
    })
    .ToList();
}

Performance

Don't let other libraries slow you down, raw Mapster performance is at least 2.5 times faster!

image

And you can boost another 1.3 - 4.0 times faster with FastExpressionCompiler!

What's new in 3.0

Debugging generated mapping function! image

Mapping your DTOs directly to EF6!

var poco = dto.BuildAdapter()
              .CreateEntityFromContext(db)
              .AdaptToType<DomainPoco>();

Change logs

https://github.com/MapsterMapper/Mapster/releases

Usages

https://github.com/MapsterMapper/Mapster/wiki

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. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.3 is compatible.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 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 (394)

Showing the top 5 NuGet packages that depend on Mapster:

Package Downloads
Mapster.DependencyInjection

Dependency Injection supports for Mapster

Furion.Extras.ObjectMapper.Mapster

Furion 对象映射 Mapster 插件。

Mapster.EFCore

EFCore plugin for Mapster

MPACKAGE.LibDomain

Package Description

Mapster.Async

Async supports for Mapster

GitHub repositories (52)

Showing the top 5 popular GitHub repositories that depend on Mapster:

Repository Stars
DotNetNext/SqlSugar
.Net aot ORM Fastest ORM Simple Easy VB.NET Sqlite orm Oracle ORM Mysql Orm 虚谷数据库 postgresql ORm SqlServer oRm 达梦 ORM 人大金仓 ORM 神通ORM C# ORM , C# ORM .NET ORM NET5 ORM .NET6 ORM ClickHouse orm QuestDb ,TDengine ORM,OceanBase orm,GaussDB orm ,Tidb orm Object/Relational Mapping
fullstackhero/dotnet-starter-kit
Production Grade Cloud-Ready .NET 8 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
anjoy8/Blog.Core
💖 ASP.NET Core 8.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
aspnetrun/run-aspnetcore-microservices
Microservices on .NET platforms used ASP.NET Web API, Docker, RabbitMQ, MassTransit, Grpc, Yarp API Gateway, PostgreSQL, Redis, SQLite, SqlServer, Marten, Entity Framework Core, CQRS, MediatR, DDD, Vertical and Clean Architecture implementation with using latest features of .NET 8 and C# 12
MonkSoul/Furion
Make .NET development easier, more versatile, and more popular.
Version Downloads Last updated
7.4.1-pre01 175,431 9/22/2023
7.4.0 6,490,754 9/21/2023
7.4.0-pre06 170,565 2/26/2023
7.4.0-pre05 51,257 1/7/2023
7.4.0-pre04 7,462 1/3/2023
7.4.0-pre03 154,640 6/27/2022
7.4.0-pre02 21,925 4/5/2022
7.4.0-pre01 38,425 4/4/2022
7.3.0 11,804,068 2/20/2022
7.2.0 5,613,512 4/10/2021
7.1.5 727,432 2/24/2021
7.1.3 228,618 1/24/2021
7.0.1 470,721 11/26/2020
7.0.0 160,427 11/12/2020
6.5.1 375,703 10/23/2020
6.5.0 435,082 8/19/2020
6.1.1 53,690 8/6/2020
6.0.0 32,654 7/30/2020
5.3.2 381,195 5/29/2020
5.3.1 59,106 5/12/2020
5.3.0 158,122 4/10/2020
5.2.0 104,077 3/14/2020
5.1.0 50,517 3/3/2020
5.0.0 896,431 2/2/2020
4.1.1 669,251 10/19/2019
4.1.0 764,266 6/15/2019
4.0.0 299,727 4/13/2019
3.3.2 131,192 3/6/2019
3.3.1 91,727 2/5/2019
3.3.0 111,615 1/29/2019
3.2.0 459,740 9/9/2018
3.1.8 616,447 11/16/2017
3.1.7 2,826 11/11/2017
3.1.6 71,657 10/15/2017
3.1.5 14,423 10/9/2017
3.1.4 6,403 10/1/2017
3.1.3 41,551 8/22/2017
3.1.1 24,924 6/19/2017
3.1.0 7,959 6/11/2017
3.0.4 25,413 5/28/2017
2.6.1 54,448 12/8/2016
2.6.0 2,304 12/3/2016
2.5.0 80,175 8/7/2016
2.4.3 3,763 7/14/2016
2.4.2 2,216 7/4/2016
2.4.1 2,171 6/22/2016
2.4.0 2,110 6/18/2016
2.3.0 28,160 3/18/2016
2.1.2 7,504 2/15/2016
2.1.1 2,217 1/29/2016
2.1.0 2,305 1/25/2016
2.0.4 2,003 1/21/2016
2.0.3 2,016 1/20/2016
2.0.2 1,950 1/19/2016
2.0.1 1,970 1/19/2016
2.0.0 1,967 1/19/2016
1.14.0 21,426 3/4/2015
1.12.0 17,546 3/2/2015