EricksonLopez.Mapper Overview
EricksonLopez.Mapper (2.0.0 on NuGet, L2) is a Roslyn incremental source generator producing compile-time, zero-reflection object mapping implementations with strict ELM* diagnostics and integrations for Result and DomainPrimitives.
- Compile-time code emission:
[Mapper]partial classes emit direct property assignments at build time ({Namespace}_{ClassName}.g.cs), eliminating runtime reflection and dynamic IL emit. - Strict mapping safety (
StrictMapping = true): Every unmapped destination property fails compilation viaELM001rather than silently leaving properties at default values. - Ecosystem integrations: Dedicated satellites map
Result<T>pipelines (EricksonLopez.Mapper.Result) and strongly-typed IDs / domain primitives (EricksonLopez.Mapper.DomainPrimitives). - Explicit reflection boundary: Runtime Mapster bridging is isolated in
EricksonLopez.Mapper.Mapster(IsAotCompatible=false), keeping core mapping packagesFullAOT.
Rendering diagram…
flowchart LR
Src["[Mapper] partial class"] --> Gen["EricksonLopez.Mapper.Generator"]
Gen --> Diag["Analyzers (ELM001-ELM018)"]
Gen --> Emit["{Namespace}_{ClassName}.g.cs"]
Emit --> Call["Zero-Reflection Direct Mapping"]View accessible text summary and structure
At compile time, EricksonLopez.Mapper.Generator inspects partial [Mapper] classes and emits zero-allocation mapping bodies alongside ELM001-ELM018 analyzer checks.
flowchart LR
Src["[Mapper] partial class"] --> Gen["EricksonLopez.Mapper.Generator"]
Gen --> Diag["Analyzers (ELM001-ELM018)"]
Gen --> Emit["{Namespace}_{ClassName}.g.cs"]
Emit --> Call["Zero-Reflection Direct Mapping"]Package Roster & Native AOT Status (7 / 7 Published)
Section titled “Package Roster & Native AOT Status (7 / 7 Published)”All 7 packages are published at 2.0.0 on NuGet (2,330 total downloads; localVersion: 3.0.0 on disk). Overall AOT status is Partial (4 Full, 1 Incompatible, 2 NotApplicable):
| Package | NuGet (2.0.0) |
AOT Status | TFMs | Role |
|---|---|---|---|---|
EricksonLopez.Mapper |
Published (466 dl) |
Full |
net8.0;net9.0;net10.0 |
Umbrella package packing Generator and Analyzers into analyzers/dotnet/cs |
EricksonLopez.Mapper.Abstractions |
Published (458 dl) |
Full |
netstandard2.0;net8.0;net9.0;net10.0 |
[Mapper], mapping attributes, IConverter<TSource, TDestination> (namespace EricksonLopez.Mapper) |
EricksonLopez.Mapper.DomainPrimitives |
Published (271 dl) |
Full |
net8.0;net9.0;net10.0 |
StrongIdToValueConverter, ValueToDomainPrimitiveConverter, DomainPrimitiveToValueConverter |
EricksonLopez.Mapper.Result |
Published (263 dl) |
Full |
net8.0;net9.0;net10.0 |
ResultMappingExtensions (Map, MapAsync, MapList) |
EricksonLopez.Mapper.Mapster |
Published (270 dl) |
Incompatible |
net8.0;net9.0;net10.0 |
Reflection-based Mapster bridge (IsAotCompatible=false, EnableTrimAnalyzer=true) |
EricksonLopez.Mapper.Generator |
Published (334 dl) |
NotApplicable |
netstandard2.0 |
Roslyn incremental source generator |
EricksonLopez.Mapper.Analyzers |
Published (268 dl) |
NotApplicable |
netstandard2.0 |
Roslyn diagnostics (ELM008, ELM009, ELM012) |
Measured directly from BenchmarkDotNet.Artifacts (22 measured rows, 0 na_error rows) on .NET 10.0.10 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI (Unknown processor hardware string; no NativeAOT reports):
MappingBenchmarks.Generator_Poco: 2.798 ns / 32 B (vsManual_Poco: 2.909 ns / 32 B;Mapperly_Poco: 2.799 ns / 32 B;Mapster_Poco: 8.442 ns / 32 B;AutoMapper_Poco: 24.904 ns / 32 B)MappingBenchmarks.Generator_Complex: 17.363 ns / 200 B (vsMapperly_Complex: 17.239 ns / 200 B;Mapster_Complex: 1,282.345 ns / 8,256 B;AutoMapper_Complex: 3,569.344 ns / 16,800 B)PolymorphicBenchmarks.Generator_Polymorphic: 22 ns / 184 BValueObjectBenchmarks.Generator_ValueObjects: 3.206 ns / 56 B