More advanced AutoMapper examples in .Net Core

How to use profiles, reverse mapping, nested mapping, and other advanced operations of the open source object mapper AutoMapper

More advanced AutoMapper examples in .Net Core

AutoMapper is a convention-based, object-oriented mapper. An object-oriented mapper is one that transforms an input object into an output object of a different type. AutoMapper also can be used to map similar or dissimilar objects (i.e., objects having properties that may or may not be identical).

We examined the basic features of AutoMapper in a previous article. In this article we’ll explore some of the advanced features of AutoMapper.

Create an ASP.Net Core project in Visual Studio

First off, let’s create a new ASP.Net Core project in Visual Studio. Note that you can create any project, i.e., MVC or even a Console Application, to work with AutoMapper. If Visual Studio 2019 is installed in your system, follow the steps outlined below to create a new ASP.Net Core project.

  1. Launch the Visual Studio IDE.
  2. Click on “Create new project.”
  3. In the “Create new project” window, select “ASP.Net Core Web Application” from the list of templates displayed.
  4. Click Next. 
  5. In the “Configure your new project” window shown next, specify the name and location for the new project.
  6. Click Create. 
  7. In the “Create New ASP.Net Core Web Application” window shown next, select .Net Core as the runtime and ASP.Net Core 2.2 (or later) from the drop-down menu at the top.
  8. Select “Web Application” as the project template to create a new ASP.Net Core web application. 
  9. Ensure that the check boxes “Enable Docker Support” and “Configure for HTTPS” are unchecked as we won’t be using those features here.
  10. Ensure that Authentication is set to “No Authentication” as we won’t be using authentication either.
  11. Click Create. 

To continue reading this article register now

How to choose a low-code development platform