Franz.Common.Mapping 2.2.7

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

Franz.Common.Mapping

A deterministic, high-performance object mapping engine for the Franz Framework.

  • Current Version: v2.2.7
  • Codename: Mapping Engine Formalization & Constructor-Aware Evolution
  • Part of the Franz Core Infrastructure Suite

🌐 Overview

Franz.Common.Mapping is a deterministic object mapping engine, designed to replace traditional β€œmagic mappers” with a strict, explicit execution model.

It is built around a single principle:

Mapping is not inference β€” it is execution over declared intent.

This version formalizes the engine into a three-layer architecture:

  • Configuration Layer β†’ mapping intent (profiles & expressions)
  • Execution Engine β†’ deterministic transformation (FranzMapper)
  • Service Layer β†’ DI-safe orchestration (MappingService)

🧠 Core Architectural Upgrade (v2.2.2)

πŸ”Ή Mapping Engine Formalization

  • Reframed the system into a deterministic mapping execution pipeline
  • Removed ambiguity from implicit mapping behavior
  • Standardized execution order across all mappings

Execution Pipeline Order:

  1. Circular reference detection (graph safety guard)
  2. Value-object unwrapping (Value pattern resolution)
  3. Collection mapping (generic enumerable handling)
  4. Configured mappings (MappingConfiguration lookup)
  5. Constructor-based projection (ConstructUsing)
  6. Property-based fallback mapping

πŸ— Architecture Separation

1. Configuration Layer (Mapping Intent)

  • All mappings are explicitly registered
  • No automatic or implicit discovery of mappings
  • Deterministic override behavior: last registration wins
config.Register(new MappingExpression<User, UserDto>()
    .ConstructUsing(u => new UserDto { Name = u.Name }));

2. Execution Engine (FranzMapper)

The FranzMapper is a pure execution engine responsible for applying mapping rules.

Key Responsibilities:
  • Graph traversal and safety control
  • Constructor resolution (including record types)
  • Property binding execution
  • Collection transformation
  • Value-object unwrapping
  • Fallback mapping logic

🧱 Constructor-Aware Mapping (NEW in v2.2.2)

πŸ”Ή Record & Immutable Type Support

The engine now natively supports:

  • C# records (positional constructors)
  • Immutable DTOs
  • Constructor-only types

Behavior:

  • Automatically detects the best constructor
  • Binds constructor parameters from source properties
  • Supports ConstructUsing overrides
  • Falls back to reflection-based instantiation only when necessary
CreateMap<User, UserDto>()
    .ConstructUsing(u => new UserDto(u.Name, u.Email));

Architectural Impact:

  • Eliminates dependency on parameterless constructors
  • Enables fully immutable DTO designs
  • Aligns mapping with domain-driven design principles

πŸ” Value Object Unwrapping System

New deterministic unwrapping model:

The engine automatically resolves wrapped values:

class WrappedInt
{
    public int Value { get; set; }
}

Mapping:

WrappedInt β†’ int

Rules:

  • Extracts Value property automatically
  • Applies scalar conversion rules before mapping
  • Preserves type safety when compatible
  • Falls back to full mapping engine if needed

πŸ“¦ Collection Mapping Engine

  • Fully supports:

    • Lists
    • Enumerables
    • Arrays
  • Element mapping is recursive and pipeline-consistent

  • Uses cached delegate dispatch for performance optimization


πŸ”„ Circular Reference Protection

  • Built-in graph traversal tracking
  • Prevents infinite recursion in object graphs
  • Uses reference-equality tracking for accuracy

Behavior:

TechnicalException: Circular mapping detected

βš™οΈ Performance Model

The framework is optimized for:

  • Minimal reflection in hot paths
  • Cached constructor and property resolution
  • Compiled delegate dispatch for recursive mappings
  • Allocation-efficient collection handling

🧩 Mapping Service (DI Layer)

A lightweight orchestration layer over the engine.

Responsibilities:

  • Dependency injection integration
  • Safe lifecycle management
  • Async-compatible API surface
var dto = service.Map<User, UserDto>(user);

Async Behavior:

  • Mapping remains CPU-bound
  • Async API is a compatibility and composition layer
  • No hidden concurrency introduced by default

βš–οΈ Design Guarantees

Franz Mapping guarantees:

  • Deterministic output for identical inputs
  • No hidden runtime discovery of mappings
  • Thread-safe execution
  • Strict separation of configuration and execution
  • Predictable graph traversal semantics

🧠 Design Philosophy

β€œMapping is not inference. It is a deterministic execution graph over explicit intent.”


πŸš€ Version Highlights (v2.2.2)

✨ Major Changes

  • Formalized mapping engine execution pipeline
  • Introduced constructor-aware mapping (records supported natively)
  • Strengthened value-object unwrapping system
  • Standardized circular reference detection
  • Unified mapping resolution order across all execution paths

βš™οΈ Internal Improvements

  • Reduced reflection dependency in runtime mapping
  • Improved constructor resolution logic
  • Stabilized collection mapping pipeline
  • Improved DI service consistency and lifecycle safety

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 (3)

Showing the top 3 NuGet packages that depend on Franz.Common.Mapping:

Package Downloads
Franz.Common.Messaging.AzureEventHubs

Shared utility library for the Franz Framework.

Franz.Common.Messaging.AzureEventBus

Shared utility library for the Franz Framework.

Franz.Common.Messaging.AzureEventGrid

Shared utility library for the Franz Framework.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.7 135 6/7/2026
2.2.6 134 6/6/2026
2.2.5 138 6/4/2026
2.2.4 122 6/3/2026
2.2.3 133 6/2/2026
2.2.2 134 6/2/2026
2.2.1 138 5/24/2026
2.1.4 134 4/27/2026
2.1.3 132 4/26/2026
2.1.2 130 4/26/2026
2.1.1 140 4/22/2026
2.0.2 144 3/30/2026
2.0.1 142 3/29/2026
1.7.8 144 3/2/2026
1.7.7 154 1/31/2026
1.7.6 153 1/22/2026
1.7.5 147 1/10/2026
1.7.4 150 12/27/2025
1.7.3 236 12/22/2025
1.7.2 225 12/21/2025
Loading failed