JetMapper 1.2.2
See the version list below for details.
dotnet add package JetMapper --version 1.2.2
NuGet\Install-Package JetMapper -Version 1.2.2
<PackageReference Include="JetMapper" Version="1.2.2" />
<PackageVersion Include="JetMapper" Version="1.2.2" />
<PackageReference Include="JetMapper" />
paket add JetMapper --version 1.2.2
#r "nuget: JetMapper, 1.2.2"
#:package JetMapper@1.2.2
#addin nuget:?package=JetMapper&version=1.2.2
#tool nuget:?package=JetMapper&version=1.2.2
<div align="center">

๐ JetMapper
A high-performance .NET object mapper - 2-4x faster than AutoMapper with 500%+ less memory usage.
</div>
โก Why JetMapper?
- โก Ultra-Fast: Expression tree compilation for maximum performance - 2-4x faster than AutoMapper
- ๐ง Memory Optimized: 500%+ savings in complex mappings
- ๐ Type Safe: Enhanced type compatibility checks
- ๐ Low Allocation: Minimal memory usage
- ๐ฆ Lightweight: Minimal dependencies
- ๐ Multi-Platform: .NET Standard 2.0/2.1, .NET Framework 4.6.2/4.7.2/4.8, .NET 6/7/8/9
- ๐ง Easy to Use: Simple and intuitive API
- โจ Fluent API: Builder pattern for custom mappings
Set()- Property value assignmentSetIf()- Conditional value assignmentSetFirstIfExist()- First available property assignmentIgnore()- Ignore sensitive propertiesBeforeMap()/AfterMap()- Lifecycle hooks
๐ฆ Installation
dotnet add package JetMapper
๐ฏ Quick Start
Basic Mapping
The simplest way to map objects - just one line of code with zero configuration:
using JetMapper;
// Simple mapping
User user = new User { FirstName = "John", LastName = "Doe" };
UserDto dto = user.FastMapTo<UserDto>();
// Collection mapping
List<User> users = GetUsers();
List<UserDto> dtos = users.FastMapToList<User, UserDto>();
Fluent API
Build complex mappings with custom transformations and property assignments:
PersonDto dto = person.Builder()
.MapTo<PersonDto>()
.Set(d => d.FullName, p => $"{p.FirstName} {p.LastName}")
.Set(d => d.Age, p => DateTime.Now.Year - p.BirthDate.Year)
.Ignore(d => d.Password)
.Create();
โจ Advanced Features
Conditional Mapping
Assign values based on conditions - perfect for status fields and business logic:
AccountDto dto = account.Builder()
.MapTo<AccountDto>()
.SetIf(d => d.Status, a => a.IsActive, a => "Active")
.SetIf(d => d.Status, a => !a.IsActive, a => "Inactive")
.Create();
Priority Assignment
Choose the first available non-null value from multiple properties:
ContactDto dto = contact.Builder()
.MapTo<ContactDto>()
.SetFirstIfExist(d => d.PreferredContact,
(d => d.Email, c => $"๐ง {c.Email}"),
(d => d.Phone, c => $"๐ฑ {c.Phone}"),
(d => d.Address, c => $"๐ {c.Address}"))
.Create();
Lifecycle Hooks
Execute custom logic before and after mapping - ideal for logging and validation:
OrderDto dto = order.Builder()
.MapTo<OrderDto>()
.BeforeMap((src, dest) => Console.WriteLine("Starting..."))
.Set(d => d.OrderNumber, o => $"#ORD-{o.Id}")
.AfterMap((src, dest) => Console.WriteLine("Completed!"))
.Create();
Async Mapping
Process large datasets asynchronously with real-time progress tracking:
List<User> users = GetLargeUserList(); // 10,000+ records
Progress<AsyncMapper.MappingProgress> progress = new Progress<AsyncMapper.MappingProgress>(p =>
Console.WriteLine($"Processing: {p.Percentage:F1}%"));
List<UserDto> dtos = await AsyncMapper.MapAsync<User, UserDto>(users, progress);
Diff Mapping
Compare two objects and detect changes automatically:
DiffResult diff = DiffMapper.FindDifferences(originalUser, updatedUser);
if (diff.HasDifferences)
{
Console.WriteLine($"Found {diff.Differences.Count} changes");
Console.WriteLine($"Similarity: {diff.SimilarityPercentage:F1}%");
}
Type Converters
Register custom type converters and enable automatic enum conversions:
// Register custom converters
MapperExtensions.AddTypeConverter<int, string>(n => n.ToString());
MapperExtensions.AddTypeConverter<DateTime, string>(dt => dt.ToString("yyyy-MM-dd"));
// Automatic enum conversions
ApiOrder apiOrder = new ApiOrder { Status = "processing" };
OrderDto dto = apiOrder.FastMapTo<OrderDto>(); // Status = OrderStatus.Processing
๐ Performance
Benchmark Results (Apple M2, .NET 6)
| Scenario | JetMapper | AutoMapper | Speed Gain |
|---|---|---|---|
| Complex Mapping | 94 ns | 259 ns | 2.76x faster |
| Bulk Mapping (1000) | 73 ยตs | 216 ยตs | 2.97x faster |
| Employee Mapping | 19 ยตs | 84 ยตs | 4.53x faster |
| Memory Usage | JetMapper | AutoMapper | Savings |
|---|---|---|---|
| Complex | 216 B | 576 B | 167% |
| Bulk (1000) | 137 KB | 593 KB | 333% |
| Employee | 49 KB | 132 KB | 173% |
๐ฏ API Reference
| Method | Description |
|---|---|
FastMapTo<T>() |
Simple one-line mapping |
Builder() |
Start fluent mapping |
Set() |
Assign property value |
SetIf() |
Conditional assignment |
SetFirstIfExist() |
Priority-based assignment |
Ignore() |
Skip property |
BeforeMap() / AfterMap() |
Lifecycle hooks |
Create() |
Execute mapping |
๐ง Advanced Features
MappingValidator
Validate mappings at compile-time to catch errors early:
ValidationResult result = MappingValidator.ValidateMapping<Person, PersonDto>();
if (!result.IsValid)
{
foreach (ValidationError error in result.Errors)
Console.WriteLine($"โ {error.PropertyName}: {error.Message}");
}
Snapshot & Restore
Save and restore object states for undo/redo functionality:
Snapshot snapshot = AsyncMapper.CreateSnapshot(user);
// Make changes...
User restored = AsyncMapper.RestoreFromSnapshot<User>(snapshot.Id);
Diagnostic Mapper
Profile performance and track metrics:
PerformanceProfile profile = DiagnosticMapper.StartPerformanceProfile("UserMapping");
// Perform mappings...
PerformanceResult result = DiagnosticMapper.EndPerformanceProfile("UserMapping");
Console.WriteLine($"Average: {result.AverageMappingTime.TotalMicroseconds:F2}ยตs");
Partial Merge
Merge specific properties from source to target:
MergeResult result = MergeMapper.PartialMerge(targetUser, sourceUser, "FirstName", "LastName");
๐ Platform Support
- .NET Standard 2.0, 2.1
- .NET Framework 4.6.2, 4.7.2, 4.8
- .NET 6.0, 7.0, 8.0, 9.0
๐ก Real-World Example
E-Commerce Order Processing - Transform database entities to view models with complex business logic:
public class OrderEntity
{
public int Id { get; set; }
public decimal Amount { get; set; }
public decimal Tax { get; set; }
public bool IsPaid { get; set; }
public bool IsShipped { get; set; }
public string CustomerEmail { get; set; }
public DateTime CreatedAt { get; set; }
}
public class OrderViewModel
{
public string OrderNumber { get; set; }
public string TotalPrice { get; set; }
public string Status { get; set; }
public string ContactInfo { get; set; }
}
OrderEntity order = new OrderEntity
{
Id = 12345,
Amount = 500m,
Tax = 90m,
IsPaid = true,
IsShipped = false,
CustomerEmail = "customer@example.com",
CreatedAt = DateTime.Now.AddDays(-2)
};
OrderViewModel viewModel = order.Builder()
.MapTo<OrderViewModel>()
.Set(vm => vm.OrderNumber, o => $"#ORD-{o.Id}")
.Set(vm => vm.TotalPrice, o => $"${(o.Amount + o.Tax):F2}")
.SetIf(vm => vm.Status, o => o.IsPaid && o.IsShipped, o => "โ
Delivered")
.SetIf(vm => vm.Status, o => o.IsPaid && !o.IsShipped, o => "๐ In Transit")
.SetIf(vm => vm.Status, o => !o.IsPaid, o => "โณ Awaiting Payment")
.Set(vm => vm.ContactInfo, o => $"๐ง {o.CustomerEmail}")
.Create();
// Result:
// OrderNumber = "#ORD-12345"
// TotalPrice = "$590.00"
// Status = "๐ In Transit"
// ContactInfo = "๐ง customer@example.com"
๐ Documentation
For detailed examples and advanced usage:
- Run benchmarks:
dotnet run -c Releaseinbenchmarks/JetMapper.Benchmarks - View examples: Check
JetMapper.Console/Program.cs
๐ค Contributing
Contributions are welcome! Feel free to:
- Report bugs via GitHub Issues
- Submit pull requests
- Suggest new features
๐ License
MIT License - See LICENSE file for details.
Made with โค๏ธ for the .NET community
Mennan Sevim
GitHub โข NuGet โข Report Issue
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Newtonsoft.Json (>= 13.0.3)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.7.2
- Newtonsoft.Json (>= 13.0.3)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.8
- Newtonsoft.Json (>= 13.0.3)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.3)
-
.NETStandard 2.1
- Newtonsoft.Json (>= 13.0.3)
-
net6.0
- Newtonsoft.Json (>= 13.0.3)
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
-
net9.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.2.2: NuGet Compatibility Fix
- 📝 Converted README from HTML to Markdown for better NuGet.org rendering
- 🎨 Improved documentation display across all platforms
v1.2.1: Documentation Fix
- 🖼๏ธ Fixed README image display on NuGet and GitHub
- 📝 Updated image paths to use GitHub raw URLs
v1.2.0: Quality & Performance Release
- 🐛 Fixed compiler warnings for cleaner builds
- 📝 Enhanced documentation with social links
- โจ Code quality improvements
v1.1.0: Multi-Platform Support Release
- 🎯 Extended platform support: .NET Standard 2.0/2.1, .NET Framework 4.6.2/4.7.2/4.8, .NET 6/7/8/9
- 🌐 Cross-platform compatibility for maximum reach
v1.0.0: Initial Release - JetMapper - Lightning-Fast Object Mapper
- โก 2-4x faster than AutoMapper
- 🧠 500%+ memory savings in complex scenarios
- โจ Fluent API with Builder Pattern (Set, SetIf, SetFirstIfExist, Ignore, Hooks)
- โก Async Mapping with progress tracking
- 🔍 Diff Mapping for object comparison
- 💾 Snapshot & Restore for undo/redo
- โ
Mapping Validator for compile-time validation
- 🔧 Enhanced Type Converters and Custom Mapping
- 📊 Diagnostic & Profiling tools
- 🔄 Partial Merge strategies
- 📚 Comprehensive documentation (English & Turkish)
- 🎯 Zero configuration required
- 🚀 Production ready