JustItMap 0.1.3
dotnet add package JustItMap --version 0.1.3
NuGet\Install-Package JustItMap -Version 0.1.3
<PackageReference Include="JustItMap" Version="0.1.3" />
<PackageVersion Include="JustItMap" Version="0.1.3" />
<PackageReference Include="JustItMap" />
paket add JustItMap --version 0.1.3
#r "nuget: JustItMap, 0.1.3"
#:package JustItMap@0.1.3
#addin nuget:?package=JustItMap&version=0.1.3
#tool nuget:?package=JustItMap&version=0.1.3
<div align="center"> <img src="assets/logos/logo.png" alt="JustItMap Logo" width="200" />
JustItMap
A lightweight, explicit, and predictable object-mapping library for .NET
๐ฏ Philosophy
JustItMap follows a simple rule:
- Convention when it is obvious - automatic mapping by property name
- Explicit mapping when it is not - override with
MapFromwhen needed
This keeps the API small, readable, and easy to reason about while still covering the common cases you need in DTO, entity, model, and view-model transformations.
โจ Features
- โ Automatic mapping by property name - Convention over configuration
- โ Compatible type conversion - Smart type conversion when needed
- โ Nested object mapping - Handles complex object hierarchies
- โ Collection mapping - Map lists, arrays, and enumerables
- โ
Explicit override - Use
MapFromfor custom mappings - โ
Explicit ignore - Skip properties with
IgnoreMap - โ Lightweight - Minimal dependency footprint
- โ Works standalone - No DI container required (but integrates well)
- โ Multi-SDK support - .NET 8.0, 9.0, 10.0
๐ฆ Installation
NuGet Package
dotnet add package JustItMap
Or via NuGet Package Manager:
Install-Package JustItMap
Supported Frameworks
- .NET 8.0 and later
- .NET 9.0
- .NET 10.0
๐ Quick Start
Basic mapping
var user = new User
{
Id = 42,
Name = "Ada Lovelace",
Email = "ada@example.com"
};
var dto = user.MapTo<UserDto>();
// dto.Id = 42
// dto.Name = "Ada Lovelace"
// dto.Email = "ada@example.com"
Explicit mapping override
Use MapFrom to explicitly map properties when names don't match:
public class UserDtoProfile : MappingProfile<User, UserDtoWithFullName>
{
public UserDtoProfile()
{
MapFrom(
destination => destination.FullName,
source => source.FirstName + " " + source.LastName
);
}
}
var source = new User
{
FirstName = "Ada",
LastName = "Lovelace"
};
var result = source.MapTo<UserDtoWithFullName>();
// result.FullName == "Ada Lovelace"
Ignoring a property
Use IgnoreMap attribute to skip properties during mapping:
public class UserDto
{
public int Id { get; set; }
public string Name { get; set; }
[IgnoreMap]
public string Password { get; set; }
}
var source = new User
{
Id = 7,
Name = "Grace",
Password = "secret"
};
var dto = source.MapTo<UserDto>();
// Password is skipped (remains null or default)
Collection mapping
var users = new[]
{
new User { Id = 1, Name = "Alan" },
new User { Id = 2, Name = "Linus" }
};
var dtos = users.MapToCollection<UserDto>();
// Returns IEnumerable<UserDto>
๐ฏ Mapping Priority Order
The mapping engine follows this priority (highest to lowest):
IgnoreMap- Properties marked to be ignored- Explicit
MapFrom- Custom mapping rules in MappingProfile - Convention mapping - Automatic mapping by property name and compatible types
This ensures that explicit rules always win over implicit behavior.
๐ง Dependency Injection
Register JustItMap in your application's DI container:
services.AddJustItMap();
Then inject and use:
public class MyService
{
private readonly IMapper _mapper;
public MyService(IMapper mapper)
{
_mapper = mapper;
}
public UserDto MapUser(User user)
{
return _mapper.Map<UserDto>(user);
}
}
๐ Documentation
For detailed documentation and advanced usage, see the full documentation.
๐งช Testing
This repository uses xUnit for testing.
To run tests locally:
dotnet test -c Release
โ๏ธ License
MIT License - see LICENSE file for details.
๐ฅ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ Support
For issues and questions, please use the GitHub Issues page.
dotnet run --project tests/JustItMap.Tests
License
MIT
| 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 is compatible. 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 is compatible. 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. |
-
net10.0
-
net8.0
-
net9.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.