Main page

.Net library for objects mapping
ModelMapper support two different way of object-mapping.
Property to Property and mapping object by invoking Constructor with arguments.

To install ModelMapper
To install ModelMapper, run the following command in the Package Manager Console

Property to Property mapping
var mapper = new ModelMapper();
mapper.ConfigurePropertyMapping<PersonModel, PersonDto>();
var model = new PersonModel(){Id = 1, Name = “Jeff Cliff”};
var dto = mapper.Map<PersonModel, PersonDto>(model);
click here to see more examples.

Constructor mapping
var mapper = new ModelMapper();
mapper.ConfigureArgumentMapping<PersonModel, PersonDto>();
var model = new PersonModel(){Id = 1, Name = “Jeff Cliff”};
var dto = mapper.Map<PersonModel, PersonDto>(model);
click here to see more examples.