JetMapper 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package JetMapper --version 1.0.0
                    
NuGet\Install-Package JetMapper -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="JetMapper" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JetMapper" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="JetMapper" />
                    
Project file
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 JetMapper --version 1.0.0
                    
#r "nuget: JetMapper, 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 JetMapper@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=JetMapper&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=JetMapper&version=1.0.0
                    
Install as a Cake Tool

🚀 JetMapper — Simple. Fast. Powerful.

AutoMapper'a alternatif olarak tasarlanmış minimal, sezgisel ve ultra-hızlı .NET object mapper.

JetMapper, AutoMapper'dan 2-4 kat daha hızlı çalışır ve %500+ daha az bellek kullanır. Karmaşık konfigürasyonlar olmadan, tek satırda mapping yapabilirsiniz.

⚡ Performance Comparison

🏆 JetMapper vs AutoMapper vs Mapster

Test Scenario JetMapper AutoMapper Mapster JetMapper vs AutoMapper JetMapper vs Mapster
Complex Mapping 94.06 ns 259.17 ns 250.89 ns 2.76x faster 2.67x faster
Complex Existing Object 79.26 ns 206.50 ns 256.77 ns 2.60x faster 3.24x faster
Bulk Mapping 72.71 µs 215.71 µs 256.31 µs 2.97x faster 3.53x faster
Employee Mapping 18.50 µs 83.78 µs 80.96 µs 4.53x faster 4.38x faster

🧠 Memory Optimization

Scenario JetMapper AutoMapper Mapster JetMapper vs AutoMapper JetMapper vs Mapster
Complex Mapping 216 B 576 B 616 B +167% savings +185% savings
Complex Existing Object 96 B 104 B 616 B +8% savings +542% savings
Bulk Mapping 136,760 B 592,520 B 615,976 B +333% savings +350% savings
Employee Mapping 48,544 B 132,304 B 127,976 B +173% savings +164% savings

🎯 Features

  • Ultra-Fast: Expression tree compilation for maximum performance
  • 🧠 Memory Optimized: 500%+ savings in complex mappings
  • 🔒 Type Safe: Enhanced type compatibility checks
  • 🚀 Low Allocation: Minimal memory usage
  • 📦 Lightweight: Minimal dependencies
  • 🔧 Easy to Use: Simple and intuitive API
  • Fluent API: Builder pattern for custom mappings
    • Set() - Property value assignment
    • SetIf() - Conditional value assignment
    • SetFirstIfExist() - First available property assignment
    • Ignore() - Ignore sensitive properties
    • BeforeMap()/AfterMap() - Lifecycle hooks

📦 Installation

dotnet add package JetMapper

🚀 Quick Start

Basit Mapping (Tek Satır)

using JetMapper;

// Tek satırda mapping
var user = new User { FirstName = "Ahmet", LastName = "Yılmaz", Age = 25 };
var dto = user.FastMapTo<UserDto>();

// Collection mapping
var users = new[]
{
    new User { FirstName = "Ahmet", LastName = "Yılmaz", Age = 25 },
    new User { FirstName = "Ayşe", LastName = "Demir", Age = 30 },
    new User { FirstName = "Mehmet", LastName = "Kaya", Age = 28 }
};
var dtos = users.FastMapToList<User, UserDto>();

Mevcut Nesneye Mapping

// Mevcut nesneyi güncelle
var existingDto = new UserDto { FirstName = "Eski", LastName = "Değer" };
user.FastMapTo(existingDto);
// existingDto artık user'ın değerlerini içerir

✨ Fluent API — Gelişmiş Mapping

Basit Değer Ataması (Set)

public class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public DateTime BirthDate { get; set; }
}

public class PersonDto
{
    public string FullName { get; set; }
    public int Age { get; set; }
}

var person = new Person 
{ 
    FirstName = "Ayşe", 
    LastName = "Demir",
    BirthDate = new DateTime(1990, 5, 15)
};

var 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)
    .Create();

// Sonuç: FullName = "Ayşe Demir", Age = 35

Koşullu Atama (SetIf)

public class Account
{
    public decimal Balance { get; set; }
    public bool IsActive { get; set; }
    public bool IsPremium { get; set; }
}

public class AccountDto
{
    public string Status { get; set; }
    public string MembershipLevel { get; set; }
}

var account = new Account 
{ 
    Balance = 5000m, 
    IsActive = true,
    IsPremium = true
};

var dto = account.Builder()
    .MapTo<AccountDto>()
    .SetIf(d => d.Status, a => a.IsActive, a => "✅ Aktif")
    .SetIf(d => d.Status, a => !a.IsActive, a => "❌ Pasif")
    .SetIf(d => d.MembershipLevel, a => a.IsPremium, a => "⭐ Premium")
    .SetIf(d => d.MembershipLevel, a => !a.IsPremium, a => "👤 Standart")
    .Create();

// Sonuç: Status = "✅ Aktif", MembershipLevel = "⭐ Premium"

Öncelikli Atama (SetFirstIfExist)

public class Contact
{
    public string Email { get; set; }
    public string Phone { get; set; }
    public string Address { get; set; }
}

public class ContactDto
{
    public string PreferredContact { get; set; }
}

var contact = new Contact 
{ 
    Email = "ahmet@example.com",
    Phone = null,
    Address = "İstanbul"
};

var dto = contact.Builder()
    .MapTo<ContactDto>()
    .SetFirstIfExist(d => d.PreferredContact,
        (d => d.Email, c => $"📧 {c.Email}"),      // Önce email kontrolü
        (d => d.Phone, c => $"📱 {c.Phone}"),      // Sonra phone
        (d => d.Address, c => $"🏠 {c.Address}"))  // En son address
    .Create();

// Sonuç: PreferredContact = "📧 ahmet@example.com"

Hassas Verileri Gizleme (Ignore)

public class User
{
    public int Id { get; set; }
    public string Username { get; set; }
    public string Password { get; set; }  // Bu alanı gizleyeceğiz
    public string Email { get; set; }
}

public class UserDto
{
    public int Id { get; set; }
    public string Username { get; set; }
    public string Password { get; set; }
    public string Email { get; set; }
}

var user = new User 
{ 
    Id = 1,
    Username = "ahmet.yilmaz",
    Password = "gizli123",
    Email = "ahmet@example.com"
};

var dto = user.Builder()
    .MapTo<UserDto>()
    .Ignore(d => d.Password)  // Şifreyi DTO'ya kopyalama
    .Create();

// Sonuç: Password = null (ignore edildi)

Lifecycle Hooks (BeforeMap/AfterMap)

var dto = order.Builder()
    .MapTo<OrderDto>()
    .BeforeMap((src, dest) => 
    {
        Console.WriteLine($"📦 Sipariş #{src.OrderId} hazırlanıyor...");
        // Veri temizleme, doğrulama vb.
    })
    .Set(d => d.OrderNumber, o => $"#ORD-{o.OrderId}")
    .Set(d => d.TotalPrice, o => $"{(o.Amount + o.Tax):C}")
    .AfterMap((src, dest) => 
    {
        Console.WriteLine($"✅ Sipariş hazır!");
        // Loglama, bildirim gönderme vb.
    })
    .Create();

🎯 Gerçek Dünya Örneği: E-Ticaret Siparişi

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 string CustomerPhone { 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; }
    public string OrderAge { get; set; }
}

var order = new OrderEntity
{
    Id = 12345,
    Amount = 500m,
    Tax = 90m,
    IsPaid = true,
    IsShipped = false,
    CustomerEmail = "musteri@example.com",
    CustomerPhone = "555-1234",
    CreatedAt = DateTime.Now.AddDays(-2)
};

var viewModel = order.Builder()
    .MapTo<OrderViewModel>()
    .BeforeMap((src, dest) => 
        Console.WriteLine($"📦 Sipariş #{src.Id} hazırlanıyor..."))
    
    .Set(vm => vm.OrderNumber, o => $"#ORD-{o.Id}")
    .Set(vm => vm.TotalPrice, o => $"{(o.Amount + o.Tax):C}")
    
    .SetIf(vm => vm.Status, o => o.IsPaid && o.IsShipped, 
        o => "✅ Teslim Edildi")
    .SetIf(vm => vm.Status, o => o.IsPaid && !o.IsShipped, 
        o => "🚚 Kargoda")
    .SetIf(vm => vm.Status, o => !o.IsPaid, 
        o => "⏳ Ödeme Bekleniyor")
    
    .SetFirstIfExist(vm => vm.ContactInfo,
        (vm => vm.CustomerEmail, o => $"📧 {o.CustomerEmail}"),
        (vm => vm.CustomerPhone, o => $"📱 {o.CustomerPhone}"))
    
    .Set(vm => vm.OrderAge, o => 
    {
        var days = (DateTime.Now - o.CreatedAt).Days;
        return days == 0 ? "Bugün" : 
               days == 1 ? "Dün" : 
               $"{days} gün önce";
    })
    
    .AfterMap((src, dest) => 
        Console.WriteLine($"✅ Sipariş hazır!"))
    
    .Create();

// Sonuç:
// OrderNumber = "#ORD-12345"
// TotalPrice = "₺590.00"
// Status = "🚚 Kargoda"
// ContactInfo = "📧 musteri@example.com"
// OrderAge = "2 gün önce"

🔧 Type Converter ve Custom Mapping

// Type Converter (int -> string)
MapperExtensions.AddTypeConverter<int, string>(n => n.ToString());

// Custom mapping
MapperExtensions.AddCustomMapping<User, ReportDto>(
    "FirstName", "DisplayName",
    src => $"{((User)src).FirstName} {((User)src).LastName}"
);

var report = user.FastMapTo<ReportDto>();

⚡ Performance Notları

  • 100,000 mapping ≈ 20–30ms Apple M2 (.NET 6) üzerinde
  • Detaylı benchmark sonuçları: benchmarks/JetMapper.Benchmarks
  • Gerçek zamanlı test: ExampleConsoleApp/Program.cs

🏆 Temel Bulgular

  • Karmaşık Mapping: JetMapper AutoMapper'dan 2.76x, Mapster'dan 2.67x daha hızlı
  • Mevcut Nesne Mapping: JetMapper AutoMapper'dan 2.60x, Mapster'dan 3.24x daha hızlı
  • Toplu Mapping: JetMapper AutoMapper'dan 2.97x, Mapster'dan 3.53x daha hızlı
  • Çalışan Mapping: JetMapper AutoMapper'dan 4.53x, Mapster'dan 4.38x daha hızlı
  • Bellek Verimliliği: Karmaşık senaryolarda %500+ bellek tasarrufu
  • Tip Güvenliği: Runtime hataları önlenir

🎯 API Özeti

Method Açıklama Örnek
Builder() Mapping işlemini başlatır user.Builder()
MapTo<T>() Hedef tipi belirler .MapTo<UserDto>()
Set() Property değeri atar .Set(d => d.Name, s => s.FullName)
SetIf() Koşullu değer atar .SetIf(d => d.Status, s => s.IsActive, s => "Active")
SetFirstIfExist() İlk mevcut property'ye göre atar .SetFirstIfExist(d => d.Contact, ...)
Ignore() Property'yi atlamaz .Ignore(d => d.Password)
BeforeMap() Mapping öncesi çalışır .BeforeMap((s, d) => {...})
AfterMap() Mapping sonrası çalışır .AfterMap((s, d) => {...})
Create() Mapping'i tamamlar .Create()

💡 İpuçları

  1. Set() kullanın - Basit değer atamaları için
  2. SetIf() kullanın - Tek koşul varsa
  3. SetFirstIfExist() kullanın - Öncelik sırasına göre atama yapacaksanız
  4. Ignore() kullanın - Hassas verileri kopyalamamak için
  5. BeforeMap/AfterMap - Loglama, validasyon için

🧩 Örnek Modeller

public class User 
{ 
    public string FirstName { get; set; } 
    public string LastName { get; set; } 
    public int Age { get; set; } 
}

public class UserDto 
{ 
    public string FirstName { get; set; } 
    public string LastName { get; set; } 
    public int Age { get; set; } 
    public string FullName { get; set; } 
}

public class ReportDto 
{ 
    public string DisplayName { get; set; } 
    public string Age { get; set; } 
}

🚀 Neden JetMapper?

✅ Avantajlar

  • Hız: AutoMapper'dan 2-4 kat daha hızlı
  • Bellek: %500+ daha az bellek kullanımı
  • Basitlik: Karmaşık konfigürasyon yok
  • Tip Güvenliği: Compile-time kontrol
  • Minimal: Sadece gerekli bağımlılıklar
  • Sezgisel: Okunabilir ve anlaşılır API

❌ AutoMapper Sorunları

  • Yavaş performans
  • Yüksek bellek kullanımı
  • Karmaşık konfigürasyon
  • Runtime hatalar
  • Büyük bağımlılık listesi

📄 Lisans

MIT — LICENSE dosyasına bakın

🙏 Teşekkürler


JetMapper — Simple. Fast. Powerful. 🚀

AutoMapper'a veda edin, JetMapper'a hoş geldiniz!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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. 
.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 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2.3 149 10/25/2025
1.2.2 130 10/25/2025
1.2.0 127 10/25/2025
1.0.0 133 10/24/2025

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