Exploring Mapperly
Mapperly is a newer object mapper library that leverages source generation to make it lightning-fast. There are many ways to create object mappers with Mapperly and many options to adjust the mapping process. The following project is similar to the others but using Mapperly.
We cover the following ways to use Mapperly:
- Injecting a mapper class
- Using a static method
- Using an extension method
Source generators were introduced with .NET 5, enabling developers to generate C# code automatically during the compilation process. These powerful tools serve as an advanced feature that taps into the Roslyn compiler pipeline, allowing for the creation and injection of source code into a project before it is compiled. Source generators help eliminate boilerplate code, ensure type safety, and improve performance by pre-calculating complex or static values. Unlike traditional code generation tools that create additional files, source...