MapFlow 1.0.3

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

MapFlow

Zero-reflection, zero-dependency object mapper for .NET. AOT compatible, no System.Reflection, no runtime code generation, no DI container required.

MapFlow sits between writing mapping code by hand (tedious) and pulling in AutoMapper (heavy, reflection-based, profile hell). It gives you three mapping strategies that scale with your needs.


Quick start

using MapFlow;

// ─── 1. Lambda-based (ad-hoc, no setup) ───
ProductDto dto = product.Map(p => new ProductDto
{
    Id = p.Id,
    Name = p.Name,
    Price = p.Price
});

// ─── 2. Interface-based (declarative, reusable) ───
ProductDto dto = Mapper.Map<Product, ProductDto>(product);
List<ProductDto> dtos = Mapper.Map<Product, ProductDto>(products);

// ─── 3. Source Generator (zero-boilerplate) ───
public partial class ProductDto : IMapFrom<Product>
{
    public int Id { get; set; }
    public string Name { get; set; } = string.Empty;
    public decimal Price { get; set; }
    // Source Generator auto-generates MapFrom(Product source)
    // You can still add CustomMapFrom(Product) for edge cases
}

// ─── In-place mutation ───
product.Apply(p => { p.Name = request.Name; });

// ─── PagedResult ───
PagedResult<ProductDto> dtos = pagedProducts.Map(p => new ProductDto(/*...*/));

Why MapFlow?

Concern AutoMapper MapFlow
Reflection Yes — startup cost + runtime Zero
Dependencies Massive graph Zero dependencies
AOT / Native ✅ Compatible
DI required Usually Not required
Profiles Yes — separate config Interfaces or lambdas
Source Generator ✅ Auto-maps matching props
Null safety NullReferenceException ArgumentNullException everywhere

API at a glance

Method What it does
source.Map(selector) Projects a single object
source.Map(selector) (IEnumerable) Projects a list
Mapper.Map<TSrc,TDst>(source) Interface-based mapping
source.MapTo<TDest>() Fluent interface-based mapping
source.Apply(mutator) Mutates and returns the same instance
source.Apply(transform) Transforms and returns a new instance
pagedResult.Map(selector) Projects PagedResult preserving metadata
Mapper.Map<TSrc,TDst>(items) Maps a list via interfaces

All methods validate arguments and throw ArgumentNullException — no silent NPEs.


Supported types

  • class
  • record
  • record struct
  • struct
  • readonly struct

The Source Generator detects class, struct, record, and record struct keywords automatically — no manual configuration.


Learn more

Full documentation, samples, and contribution guide:

https://github.com/HancerMercede/MapFlow

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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 was computed.  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.
  • net8.0

    • No dependencies.

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
1.0.3 35 6/3/2026
1.0.2 38 6/3/2026
1.0.0 42 6/3/2026