CleanMapper is a lightweight, strongly-typed object mapping library for .NET. This guide helps you integrate it quickly.
Install via NuGet:
dotnet add package CleanMapperOr via Package Manager:
Install-Package CleanMapperusing CleanMapper.Core;
public class UserProfile : MapProfile
{
public override void Configure(MappingConfiguration config)
{
config.CreateMap<UserDto, User>();
config.CreateMap<User, UserDto>();
}
}var mapper = new Mapper(new UserProfile());
var dto = new UserDto { Id = 1, Name = "Taleh" };
var user = mapper.Map<UserDto, User>(dto);For mapping collections or advanced scenarios, see Extensions.md.