Skip to content

A fast, fun and stimulating object to object Mapper

License

Notifications You must be signed in to change notification settings

chaowlert/Mapster

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!
And you can boost another 1.3 - 4.0 times faster with FastExpressionCompiler!

image

What's new in 3.3

Step-into debugging now working in .NET Core!!! image

Change logs

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

Usages

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

About

A fast, fun and stimulating object to object Mapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 92.7%
  • PowerShell 7.2%
  • Batchfile 0.1%