Introduction To Mapper NuGet

In this blog, we will talk about my first Mapper NuGet which is based on the Generic Extension method to map objects from one type to another.

On Feb 21, 2019, I uploaded my first Mapper NuGet on "". You can find it here, which helps the developers to map object properties from one to another without adding any complex lines.
For example, if we have one entity table which has 30 or more than 30 properties and we want to use it in all properties with ViewModel, we have to write the same line 30 times like below.
  1. viewModel.Col1 =entityObj.Col1;    
  2. viewModel.Col2 =entityObj.Col2;    
  3. viewModel.Col3 =entityObj.Col3;    
  4. …       
This is definitely time-consuming and increases the number of lines. It is also possible to mismatch the properties which will result in an error. So, to overcome this kind of thing, I uploaded the Nuget which you can install using the below methods.
Using Package Manager
  1. Install-Package Faisal.Map.Object -Version 1.0.4  
Using .NET CLI
  1. dotnet add package Faisal.Map.Object --version 1.0.4  
Using Paket CLI
  1. paket add Faisal.Map.Object --version 1.0.4  
Using NuGet - Solution
 Mapper Nuget
I also published an article about Generic Extension method which you can read here. This article explains only mapping for the single class/object. In NuGet, I added to map List<class> too. 
How to use (After install NuGet),
To Map Single Object.
  1. Students student = _dbContext.Students.Where(a=>a.ID == 1);  
  2. StudentsViewModel records = student.MapProperties<Students>();  
To Map List of Object.
  1. List<StudentsViewModel> studentsVM = new List<StudentsViewModel>();  
  2. List<Students> students = _dbContext.Students.ToList();  
  3. students.MapListProperties<Students, StudentsViewModel>(studentsVM);  

I hope this NuGet will be helpful and useful in your project. Please install it and give your valuable feedback and comments. Let me know how you like and understand this blog and how I could improve it.