12/29/2023 0 Comments Fluid mask tutorialIn real-time projects, many times we need to map the objects between the UI/Domain or Service/Domain layers. That means the Mapping of code is done again and again between the source and the destination. Then you need to write the code for each property data moving from the source class to the destination class. the properties in the class are increased. But, tomorrow what will you do if the data i.e. Now if you run the application, then you will get the output as expected. namespace AutoMapperDemoĬonsole.WriteLine("Name:" + empDTO.Name + ", Salary:" + empDTO.Salary + ", Address:" + empDTO.Address + ", Department:"+ empDTO.Department) The following example, copy the data from one object to another object in the traditional approach i.e. Once you have the employee object, then you need to create the EmployeeDTO object as well as need to copy the data from the employee object to the employee DTO object as shown in the below image. Now, if you want to copy the data or transfer the data from the Employee object to the EmployeeDTO object, then in the traditional approach first you need to create and populate the Employee object as shown in the below image. Let’s say we have two classes such as Employee and EmployeeDTO as shown in the below image. Let’s understand why do we need automapper in C# with an example.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |