Mapster 3.1.4

A fast, fun and stimulating object to object mapper.  Kind of like AutoMapper, just simpler and way, way faster.

There is a newer version of this package available.
See the version list below for details.
Install-Package Mapster -Version 3.1.4
dotnet add package Mapster --version 3.1.4
<PackageReference Include="Mapster" Version="3.1.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mapster --version 3.1.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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, Mapster is at least twice faster!

image

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/chaowlert/Mapster/releases

Usages

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

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, Mapster is at least twice faster!

image

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/chaowlert/Mapster/releases

Usages

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

Release Notes

allow mapping class extended with IEnumerable (sp thx to Satano)

Showing the top 8 GitHub repositories that depend on Mapster:

Repository Stars
bing-framework/Bing.NetCore
Bing是基于 .net core 2.0 的框架,旨在提升团队的开发输出能力,由常用公共操作类(工具类、帮助类)、分层架构基类,第三方组件封装,第三方业务接口封装等组成。
tinohager/Nager.Date
C# Worldwide public holiday calculation. Please star (★) this project!
fluentsprings/ExpressMapper
Mapping .Net types
agileobjects/AgileMapper
A zero-configuration, highly-configurable object-object mapper with viewable execution plans. Projects queries, transforms, deep clones, updates and merges via extension methods, or a static or instance API. Targets .NET Standard 1.0+ and .NET 3.5+
SkyChenSky/Sikiro.Tookits
Base And Frequently-used Tools Library.You can use it on nuget
DogusTeknoloji/BatMap
🦇 Convention-based, fast object mapper.
MUnique/OpenMU
This project aims to create an easy to use, extendable and customizable server for a MMORPG called "MU Online".
stoveproject/Stove
Domain Driven Design oriented application framework, meets CRUD needs

Read more about the GitHub Usage information on our documentation.

Version History

Version Downloads Last updated
4.1.1 16,165 10/19/2019
4.1.0 85,299 6/15/2019
4.0.0 66,913 4/13/2019
3.3.2 40,848 3/6/2019
3.3.1 29,063 2/5/2019
3.3.0 4,072 1/29/2019
3.2.0 123,050 9/9/2018
3.1.8 167,124 11/16/2017
3.1.7 1,679 11/11/2017
3.1.6 24,430 10/15/2017
3.1.5 2,097 10/9/2017
3.1.4 3,305 10/1/2017
3.1.3 27,381 8/22/2017
3.1.1 16,257 6/19/2017
3.1.0 3,915 6/11/2017
3.0.4 3,831 5/28/2017
2.6.1 30,396 12/8/2016
2.6.0 1,126 12/3/2016
2.5.0 32,210 8/7/2016
2.4.3 2,428 7/14/2016
2.4.2 1,183 7/4/2016
2.4.1 1,199 6/22/2016
2.4.0 1,074 6/18/2016
2.3.0 7,673 3/18/2016
2.1.2 3,835 2/15/2016
2.1.1 1,190 1/29/2016
2.1.0 1,296 1/25/2016
2.0.4 1,008 1/21/2016
2.0.3 1,022 1/20/2016
2.0.2 947 1/19/2016
2.0.1 957 1/19/2016
2.0.0 944 1/19/2016
1.14.0 11,809 3/4/2015
1.12.0 1,229 3/2/2015
Show less