AutoMapper is well known in the .NET community. It bills itself as “a simple little library built to solve a deceptively complex problem - getting rid of code that maps one object to another,” and it does the job nicely.
In the past, I’ve used it exclusively with ASP.NET APIs. However, the method for utilizing it via dependency injection has changed. So let’s review how to get started, how to define mappings and how to inject our mappings into ASP.NET Core APIs.
permalinkGetting Started
Like most .NET libraries, we can install the AutoMapper
package from Nuget.