ASP.NET Core: Using AutoMapper
AutoMapper is a simple C# library that helps to transform one object into another object. This is a less configuration-based conventional object-to-object mapper library. This object-to-object mapping works by transforming the input object of one type to an output object of a different type. Why the AutoMapper is needed? The main reason behind using AutoMapper is to make sure that we can hide the important properties of the core object (aka the domain object) from showing them directly to the client. Let's take an example here, in any Employee Information System the actual Employee Domain object has various properties like Name, DeptName, Designation, Salary, Experience, TasksToPerform, etc. When this object is needed by the Accounting System, it just needs Name, DeptName, and Salary, so instead of passing the Employee object to the Accounting System with unnecessary data, it's better to create a separate ViewModel DTO with necessary properties for Accounting System and map ...