AutoMappic 0.3.0
dotnet add package AutoMappic --version 0.3.0
NuGet\Install-Package AutoMappic -Version 0.3.0
<PackageReference Include="AutoMappic" Version="0.3.0" />
<PackageVersion Include="AutoMappic" Version="0.3.0" />
<PackageReference Include="AutoMappic" />
paket add AutoMappic --version 0.3.0
#r "nuget: AutoMappic, 0.3.0"
#:package AutoMappic@0.3.0
#addin nuget:?package=AutoMappic&version=0.3.0
#tool nuget:?package=AutoMappic&version=0.3.0
AutoMappic v0.3.0
Zero-Reflection. Zero-Overhead. Native AOT-First.
AutoMappic is a high-performance object-to-object mapper for .NET 9 and .NET 10. It uses Roslyn Interceptors to replace standard reflection-based mapping with statically-generated C# at compile time.
Table of Contents
Goals
- High Performance: Faster than manual mapping by enabling aggressive JIT inlining of straight-line C# assignments.
- Native AOT Ready: 100% compatible with Native AOT and trimming. No dynamic code generation or reflection at runtime.
- Build-Time Safety: Mapping errors (ambiguity, missing members, circular references) are caught during compilation, not at runtime.
- Zero-Startup Cost: Eliminates reflection-based profile scanning. Dependency injection initializes instantly.
Development
AutoMappic is built for extreme performance using modern .NET tooling.
Tooling
- CSharpier: Opinionated code formatter for consistent semantics across the tree.
- Roslyn SDK: Powers the incremental source generator and interceptors.
Common Tasks
- Build:
dotnet build /p:TreatWarningsAsErrors=true - Test:
dotnet run --project tests/AutoMappic.Tests/AutoMappic.Tests.csproj - Bench:
dotnet run -c Release --project tests/AutoMappic.Benchmarks/AutoMappic.Benchmarks.csproj
License
This project is licensed under the MIT License - see the LICENSE file for details.
Benchmarks
AutoMappic achieves performance parity with manual hand-written C# by shifting all mapping logic to compile-time.
Runtime Throughput (Mapping User to UserDto)
| Method | Engine | Mean | Ratio | Allocated |
|---|---|---|---|---|
| Manual HandWritten | Static Assignment | 0.81 ns | 1.00 | 0 B |
| AutoMappic_Intercepted | Source Gen + Interceptors | 0.82 ns | 1.01 | 0 B |
| Mapperly_Explicit | Source Generation | 0.84 ns | 1.04 | 0 B |
| AutoMapper_Legacy | Reflection / IL Emit | 14.20 ns | 17.53 | 120 B |
Quick Start
using AutoMappic;
using Microsoft.Extensions.DependencyInjection;
// 1. Define a Profile (Exactly like AutoMapper)
public class UserProfile : Profile
{
public UserProfile()
{
CreateMap<User, UserDto>().ReverseMap();
}
}
// 2. Setup Dependency Injection (AOT-Friendly!)
var services = new ServiceCollection();
services.AddAutoMappic(); // Compile-time discovery of all profiles
// 3. Use it (Async-Ready!)
var serviceProvider = services.BuildServiceProvider();
var mapper = serviceProvider.GetRequiredService<IMapper>();
// Zero dynamic code, 100% static execution
var dto = mapper.Map<User, UserDto>(new User { Name = "Digvijay Chauhan" });
NuGet Packages
- AutoMappic: The main package containing the
IMapperabstractions and the runtime core. - AutoMappic.Generator: The Roslyn incremental source generator. Typically included as a private asset/analyzer.
<PackageReference Include="AutoMappic" Version="0.3.0" />
Diagnostics
AutoMappic provides a rigorous build-time validation layer, ensuring structural integrity before the application starts.
| ID | Title | Severity | Impact |
|---|---|---|---|
| AM001 | Unmapped Destination | Error | Detects writable properties with no source resolution. |
| AM002 | Ambiguous Mapping | Error | Flags collisions between direct matches and flattened paths. |
| AM003 | Misplaced CreateMap | Warning | Identifies mappings declared outside of Profile constructors. |
| AM004 | Unresolved Interceptor | Warning | Alerts when a map call falls back to the reflection engine. |
| AM005 | Missing Constructor | Error | Ensures destination types are instantiable without reflection. |
| AM006 | Circular Reference | Error | Detects recursive mapping loops to prevent StackOverflow. |
| AM007 | Symbol Resolution | Warning | Reports when Roslyn cannot fully resolve a mapping's types. |
| AM008 | ProjectTo Interjection | Warning | Identifies procedural logic that cannot be converted to SQL. |
| AM009 | Duplicate Mapping | Warning | Detects conflicting configurations for the same type-pair. |
| AM010 | Performance Hotpath | Info | Flags high-allocation nested collection mappings. |
| AM011 | Multi-Source ProjectTo | Error | Prevents unsupported multi-source database projections. |
| AM012 | Asymmetric Mapping | Warning | Flags mappings with no writable destination properties. |
Proven at Scale
AutoMappic has been verified as a drop-in replacement for complex enterprise templates like jasontaylordev/CleanArchitecture. By simply switching the namespace and enabling interceptors, even projects with deep Entity Framework projections and complex profiles can achieve Native AOT compatibility.
Documentation
For detailed guides, API reference, and advanced tutorials, visit our documentation site: automappic.digvijay.dev
Built for the .NET Community.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
-
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.