AutoMapperLite 2.0.6
See the version list below for details.
dotnet add package AutoMapperLite --version 2.0.6
NuGet\Install-Package AutoMapperLite -Version 2.0.6
<PackageReference Include="AutoMapperLite" Version="2.0.6" />
<PackageVersion Include="AutoMapperLite" Version="2.0.6" />
<PackageReference Include="AutoMapperLite" />
paket add AutoMapperLite --version 2.0.6
#r "nuget: AutoMapperLite, 2.0.6"
#:package AutoMapperLite@2.0.6
#addin nuget:?package=AutoMapperLite&version=2.0.6
#tool nuget:?package=AutoMapperLite&version=2.0.6
AutoMapperLite
A lightweight and convention-friendly object-to-object mapper for .NET, inspired by AutoMapper — but simplified for small to medium projects and high control over mapping behavior.
🚀 Features
- Simple and clean API
- Supports
.ForMember
and.ForPath
- Auto mapping for matching property names
- Nested object mapping
- Collection mapping (e.g.,
List<T>
) - Profile-based mapping organization
- Dependency Injection (DI) ready
📦 Installation
1. Install from NuGet Package
To install via NuGet, run the following command:
dotnet add package AutoMapperLite --version 2.0.4
2. Register AutoMapperLite in Program.cs
using AutoMapperLite;
builder.Services.AddAutoMapperLite(Assembly.GetExecutingAssembly());
3. Define your models
public class User
{
public string FirstName { get; set; }
public string LastName { get; set; }
public Department Department { get; set; }
}
public class Department
{
public string Name { get; set; }
}
4. Define your view model
public class UserViewModel
{
public string FullName { get; set; }
public DepartmentViewModel DepartmentViewModel { get; set; }
}
public class DepartmentViewModel
{
public string DepartmentName { get; set; }
}
5. Create a mapping profile
public class MappingProfile : Profile
{
public override void Configure(IMapperConfig config)
{
config.CreateMap<User, UserViewModel>()
.ForMember(dest => dest.FullName, src => src.FirstName + " " + src.LastName)
.ForPath("DepartmentViewModel.DepartmentName", src => src.Department.Name);
}
}
6. Inject and use IMapper
[ApiController]
[Route("api/[controller]")]
public class UsersController : ControllerBase
{
private readonly IMapper _mapper;
public UsersController(IMapper mapper)
{
_mapper = mapper;
}
[HttpGet]
public IActionResult Get()
{
var users = new List<User> {
new User {
FirstName = "John",
LastName = "Doe",
Department = new Department { Name = "IT" }
}
};
var result = _mapper.Map<List<UserViewModel>>(users);
return Ok(result);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
• Added ForPath and ForMember support
• Improved collection mapping (List<T>)
• Simplified usage with Map<TDestination>(TSource) format
• Support for nested property mapping and configuration profiles
• Refactored internal Mapper logic and added DI support