MapperLabs 1.0.0
dotnet add package MapperLabs --version 1.0.0
NuGet\Install-Package MapperLabs -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MapperLabs" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MapperLabs" Version="1.0.0" />
<PackageReference Include="MapperLabs" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MapperLabs --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MapperLabs, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MapperLabs@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MapperLabs&version=1.0.0
#tool nuget:?package=MapperLabs&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MapperLabs 🚀
MapperLabs is a high-performance, flexible object mapping library for .NET applications. It uses Expression Trees and IL Emit instead of reflection for maximum performance.
🌟 Key Features
Feature | Description |
---|---|
⚡ Zero Reflection | Optimized with Expression Trees and Dynamic Methods |
🛠 Fluent API | Chainable configuration for readability |
🔄 Case-Insensitive | Auto-mapping for UserName ↔ username |
📦 DI Support | Seamless ASP.NET Core integration |
🧩 Nested Mapping | Deep mapping for nested objects |
📊 Collections | Support for List<T> , Dictionary<TKey,TValue> |
📦 Installation
dotnet add package MapperLabs
🚀 Quick Start
1. Basic Mapping
public class UserDto
{
public string Name { get; set; }
public int Age { get; set; }
}
public class UserEntity
{
public string Name { get; set; }
public int Age { get; set; }
}
// Configuration
TypeAdapterConfig<UserDto, UserEntity>.DefaultConfig();
// Usage
var userEntity = userDto.Adapt<UserEntity>();
2. Custom Mapping
TypeAdapterConfig<ProductDto, ProductEntity>
.ForType()
.ForMember(dest => dest.TotalPrice, src => src.Price * src.Quantity) // Custom calculation
.ForMember(dest => dest.SKU, opt => opt.Ignore()) // Ignore property
.Register();
3. Collection Mapping
var products = productDtos.Adapt<List<ProductEntity>>(); // List mapping
var dict = sourceList.Adapt<Dictionary<int, string>>(); // Dictionary support
📊 Performance Benchmarks
Library 1M Objects (ms) Key Features
MapperLabs 12 ✅ Zero Reflection, ✅ Fluent API
Mapster 18 ⚠️ Partial Reflection
AutoMapper 145 ⚠️ Full Reflection-Based
Test Environment: .NET 8.0, Intel i7-11800H, 32GB RAM
📚 Advanced Usage
Nested Object Mapping
public class OrderDto
{
public CustomerDto Customer { get; set; }
public List<ItemDto> Items { get; set; }
}
public class OrderEntity
{
public CustomerEntity Customer { get; set; }
public List<ItemEntity> Items { get; set; }
}
// Auto nested mapping
TypeAdapterConfig<OrderDto, OrderEntity>.DefaultConfig();
Custom Converters
public class DateToAgeConverter : IConverter<DateTime, int>
{
public int Convert(DateTime source) => DateTime.Now.Year - source.Year;
}
// Configuration
TypeAdapterConfig<UserDto, UserEntity>
.ForType()
.ForMember(dest => dest.Age, src => src.BirthDate.ConvertUsing<DateToAgeConverter>());
👨💻 Contributing
Fork the repository:
git clone https://github.com/tolgatandogan/MapperLabs.git
Create a branch:
git checkout -b feature/your-feature-name
Run tests:
dotnet test tests/SmartMapper.Tests
Commit changes:
git commit -m "feat: Add your feature"
Push and open a PR!
---
## 📜 License
Licensed under the [MIT License](LICENSE).
**Contact:**
📧 tolgatandogan@yandex.com | [GitHub Profile](https://github.com/tolgatandogan)
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
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.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 187 | 4/3/2025 |