Skip to content

Using AutoMapper with ASP.NET Core 3

AutoMappers usage via dependency injection changed in ASP.NET Core 3. This post shows how to use the new implementation.

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.