Mapster is an Open Source library for mapping objects in .Net focused on ease of use and high efficiency.
Mapping objects is a common need in programming, which forces the creation of a lot of repetitive code with little added value (boilerplate).
To perform this process more pleasantly, there are many libraries, with the most popular probably being the well-known AutoMapper.
Mapster is an alternative that stands out both for its ease of use and its design focused on high speed and low memory consumption.
To use Mapster we don’t need to create any prior configuration. It works through extension methods, so mapping an entity to a new instance of another class is as simple as doing
var destObject = sourceObject.Adapt<Destination>();
Or, to map to an existing instance
sourceObject.Adapt(destObject);
It’s that simple. One might think that this lack of configuration has a performance penalty, but that’s not the case.
Mapster is extremely fast, while maintaining minimal memory consumption, even several orders of magnitude above alternatives like AutoMapper.
Of course, Mapper not only performs conversions between simple objects, but also collections, composite objects, or almost any situation we might need. Furthermore, it has a large number of additional features, such as custom mappings, actions before and after mapping.
On the other hand, efficiency can be improved even more with the inclusion of https://github.com/dadhi/FastExpressionCompiler, becoming very similar to the performance obtained with “handwritten” mapping.
As if all this weren’t enough, it’s also possible to add ExpressionDebugger to be able to debug inside the mapping without losing efficiency, solving one of the biggest disadvantages of using automatic mapping libraries.
Mapster is available to add conveniently to our project via a Nuget package and is compatible with .Net Framework and .Net Standard.
For more information, consult the abundant information on the project’s website https://github.com/MapsterMapper/Mapster, where you will also find all the code for it.

