guillaume_yvo
8/30/2019 - 8:48 PM

Automapper configuration ASP CORE 2_2

// Install package
Install-Package AutoMapper -Version 9.0.0
Install-Package AutoMapper.Extensions.Microsoft.DependencyInjection -Version 7.0.0

// Configure method in startup.cs
services.AddAutoMapper(typeof(AutoMapperProfile));

//configure mapper AutoMapperProfile
public class AutoMapperProfile : Profile
	{
		public AutoMapperProfile()
		{
			CreateMap<User, UserDto>();
			CreateMap<UserDto, User>();
		}
	}