PropertyMapper 0.1.0

dotnet add package PropertyMapper --version 0.1.0
                    
NuGet\Install-Package PropertyMapper -Version 0.1.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="PropertyMapper" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PropertyMapper" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="PropertyMapper" />
                    
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 PropertyMapper --version 0.1.0
                    
#r "nuget: PropertyMapper, 0.1.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 PropertyMapper@0.1.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=PropertyMapper&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=PropertyMapper&version=0.1.0
                    
Install as a Cake Tool

PropertyMapper

High-performance, IL-based property mapper for .NET 10+.

Full documentation, API reference and benchmarks: github.com/vlasta81/PropertyMapper

Installation

dotnet add package PropertyMapper

Quick Start

using PropertyMapper;

var mapper = new PropMap();

// Single object
OrderDto dto = mapper.Map<Order, OrderDto>(order);

// Collection → List
List<OrderDto> dtos = mapper.MapToList<Order, OrderDto>(orders);

// Span batch
OrderDto[] batch = mapper.MapBatch<Order, OrderDto>(orders.AsSpan());

// Async
OrderDto dto = await mapper.MapAsync<Order, OrderDto>(order, cancellationToken);

Key Features

Feature Details
IL code generation Delegates compiled once via Reflection.Emit — subsequent calls as fast as hand-written code
Zero-allocation hot path Lock-free FrozenDictionary cache after first compilation
Structs, records, classes Mutable classes/structs and immutable records with primary constructors
Nested objects Recursive mapping with configurable depth limit
Nullable support Wrapping, unwrapping, and nullable-to-nullable conversions
Operator conversions Respects implicit/explicit operators
Rich collections List<T>, T[], ImmutableArray<T>, ImmutableList<T>, HashSet<T>, FrozenDictionary<K,V>, nested lists
Async & parallel MapAsync, MapParallelAsync, MapStreamAsync, MapStreamBatchedAsync
Fluent configuration PropMapBuilder with Ignore, MapFrom, AfterMap, ReverseMap per type-pair
FieldMask / Projection MapThenApplyMask, Project<TIn,TOut> for EF Core / IQueryable
Dependency Injection AddPropertyMapper() extension for IServiceCollection
Diagnostics Validate<TIn,TOut>(), GetStatistics(), Warmup, WarmupBatch

Configuration

using PropertyMapper.Configuration;

// Simple — PropMapConfiguration
PropMap mapper = new PropMap(new PropMapConfiguration
{
    MaxMappingDepth = 8,
    ThrowOnUnmappedProperties = true
});

// Advanced — PropMapBuilder (fluent, frozen singleton)
PropMap mapper = new PropMapBuilder()
    .WithConfiguration(cfg => cfg.WithMaxDepth(8))
    .Configure<User, UserDto>(c =>
    {
        c.Ignore(x => x.PasswordHash);
        c.MapFrom(x => x.FullName, src => $"{src.FirstName} {src.LastName}");
        c.ReverseMap();
    })
    .Configure<Order, OrderDto>(c =>
        c.MapFrom(x => x.Total, src => src.Subtotal + src.Tax))
    .WarmupOnStartup<User, UserDto>()
    .Build();

Dependency Injection

// Minimal
services.AddPropertyMapper();

// With configuration
services.AddPropertyMapper(builder =>
{
    builder.WithConfiguration(cfg => cfg.WithMaxDepth(16));
    builder.Configure<User, UserDto>(c => c.Ignore(x => x.PasswordHash));
    builder.WarmupOnStartup<User, UserDto>();
});

Inject IPropMap (highly recommended) instead of PropMap directly:

public class OrderService(IPropMap mapper) { }

Benchmarks (Run 9 — .NET 10, Intel i5-7600K)

Scenario PropertyMapper AutoMapper Mapster
Simple object 13.5 ns 58.3 ns 16.3 ns
Nested object 40.4 ns 89.2 ns 43.7 ns
Struct (zero-alloc) 7.2 ns 54.7 ns 7.4 ns
First call (cold path) 278 μs 927 μs 2,028 μs
Collection N=1 000 ~31 μs ~35 μs ~31 μs

License

MIT © 2025 vlasta81

Product Compatible and additional computed target framework versions.
.NET 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. 
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
0.1.0 68 4/5/2026