CleanMapper 1.0.1
dotnet add package CleanMapper --version 1.0.1
NuGet\Install-Package CleanMapper -Version 1.0.1
<PackageReference Include="CleanMapper" Version="1.0.1" />
<PackageVersion Include="CleanMapper" Version="1.0.1" />
<PackageReference Include="CleanMapper" />
paket add CleanMapper --version 1.0.1
#r "nuget: CleanMapper, 1.0.1"
#addin nuget:?package=CleanMapper&version=1.0.1
#tool nuget:?package=CleanMapper&version=1.0.1
๐งน CleanMapper
CleanMapper is a lightweight, reflection-minimal object mapping library for .NET. It enables fast, strongly-typed mappings between DTOs, ViewModels, and domain models with a clean and minimal API design.
โจ Features
- โ Strongly-typed mapping registration
- โ Auto-maps properties with matching names and types
- โ Profile-based configuration for organized mappings
- โ Extension methods for mapping collections and advanced scenarios
- โ Lightweight with no runtime reflection during mapping
๐ Installation
Install via NuGet:
dotnet add package CleanMapper
Or via the Package Manager:
Install-Package CleanMapper
๐ป Usage
โก๏ธ 1. Create a Profile
Define a mapping profile to configure your mappings:
using CleanMapper.Core;
public class UserProfile : MapProfile
{
public override void Configure(MappingConfiguration config)
{
config.CreateMap<UserDto, User>();
config.CreateMap<User, UserDto>();
}
}
โก๏ธ 2. Map objects
var mapper = new Mapper(new UserProfile());
var dto = new UserDto { Id = 1, Name = "Taleh" };
var user = mapper.Map<UserDto, User>(dto);
โก๏ธ 3. Map lists
using CleanMapper.Extensions; // โ ๏ธ Required for extension methods
var userDtos = new List<UserDto>
{
new UserDto { Id = 1, Name = "Alice" },
new UserDto { Id = 2, Name = "Bob" }
};
var users = mapper.MapList<UserDto, User>(userDtos).ToList();
๐ก Note: To use
MapList
,MapArray
, and other collection mapping extensions, ensure you add:using CleanMapper.Extensions;
Or add it as a global using in your project for convenience.
๐ค Contributing
Contributions, issues, and feature requests are welcome!
Please open an issue to discuss improvements or submit a pull request directly.
๐ License
This project is licensed under the MIT License. See LICENSE.txt for details.
๐ Author
CleanMapper is built with dedication by Taleh Karimov.
โญ Star this repository if you find it helpful, and follow for upcoming advanced mapping features!
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
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.