Skip to main content

Mapping that stays visible

Valiant Mapping turns a small mapper declaration into direct C# assignments. It handles conventional members, immutable targets, nested shapes, collections, enums, explicit transformations, conditional rules, and mapper composition—without runtime assembly scanning.

using Valiant.Mapping;

[ValiantMapper]
public sealed partial class UserMapper : MapperDefinition<User, UserDto>;

var dto = new UserMapper().Map(user);

The generated partial class implements IMapper<User, UserDto> and exposes a strongly typed Map(User source) method.

Why use it?

CapabilityWhat Valiant generates
Convention mappingDirect reads and assignments for compatible public fields and properties
Immutable targetsConstructor arguments for records and constructor-only models
Shape changesFlattening, unflattening, enum conversion, and reusable nested/collection mappers
Explicit ownershipMap, Ignore, conditions, fallbacks, and null policy in Configure
Runtime selectionTyped mapper, IMapper facade, and IMapperFactory through generated DI registration
DeploymentA fast generated backend suited to trimming and Native AOT, plus a debuggable backend
Start with conventions

Declare the mapper and compile. Add Configure only when the source and target shapes intentionally differ. Once Configure is present, list every target mapping you own explicitly.

Documentation map

The sample catalog covers every executable Mapping scenario and links each one to its self-contained source folder.