Guides & Recipes — Mapper
Recommended compile-time mapping patterns without runtime reflection.
Recipe 1: Async Result<T> Projections with MapAsync
Section titled “Recipe 1: Async Result<T> Projections with MapAsync”Chain EricksonLopez.Mapper.Result directly onto repository calls returning Task<Result<OrderEntity>> or ValueTask<Result<OrderEntity>> using MapAsync(mapper.Map).
Recipe 2: Strongly-Typed IDs with Mapper.DomainPrimitives
Section titled “Recipe 2: Strongly-Typed IDs with Mapper.DomainPrimitives”Attach [UseConverter(typeof(StrongIdToValueConverter<OrderId, Guid>))] or ValueToDomainPrimitiveConverter on mapper fields to project strongly-typed IDs and validated primitives without manual boilerplate.
Recipe 3: Prefer partial class Mappers Across v1/v2/v3
Section titled “Recipe 3: Prefer partial class Mappers Across v1/v2/v3”Declare [Mapper] public partial class MyMapper so your mapper classes behave identically across v1.0.0, v2.0.0, and local 3.0.0 ({Name}Impl interface generation was refined in local v3.0.0).