Transformations.Mapping 2.0.0

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

Transformations.Mapping

A zero-reflection, NativeAOT-ready object mapper using Roslyn source generators.

NuGet

📖 Overview

Transformations.Mapping completely replaces runtime reflection mappers (like AutoMapper) with compile-time Roslyn Source Generators. By attributing your classes, the compiler generates lightning-fast To{Target}() and From{Target}() extension methods directly into your assemblies footprint.

🚀 Why Transformations.Mapping?

Runtime reflection maps are notoriously slow, difficult to trim, and fundamentally incompatible with NativeAOT workloads. By shifting the work to the compiler, you guarantee zero cold-start overhead, pristine memory allocation profiles, and immediate compile-time errors if your object graphs fall out of sync.

💡 Key Features & Examples

1. Zero-Friction DTO Mapping

Add the [MapTo] attribute to the partial class, and let the generator seamlessly map shared property names.

// 1. Mark your domain class
[MapTo<UserDto>]
public partial class User
{
    public int Id { get; set; }
    public string GlobalName { get; set; }
    
    // Ignore properties you don't want mapped
    [IgnoreMap]
    public string SecretHash { get; set; }
}

// 2. Consume the generated methods (no dependency injection required)
User domainModel = GetUserFromDb();
UserDto dto = domainModel.ToUserDto();     // Auto-generated!
User reconstructed = User.FromUserDto(dto); // Auto-generated!

2. Rename & Align Properties

If the Target DTO has a different property name, map them directly.

public partial class User
{
    // Maps "GlobalName" to the target's "DisplayName" property
    [MapProperty("DisplayName")]
    public string GlobalName { get; set; }
}

🛠 Advanced Usage

The analyzer continuously runs in the background. If the UserDto expects a DateOfBirth property that isn't mapped, the analyzer emits a TXMAP001 warning in your IDE. You can escalate this to a build-breaking error via .editorconfig guaranteeing mappings never quietly fail in production.

📦 Dependencies

  • Transformations.Mapping (Attribute definitions)
  • Automatically provisions Transformations.Mapping.Generator (Source Generator)

Part of the Transformations ecosystem. Designed for modern .NET 8+.

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 is compatible.  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 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
2.0.0 108 4/10/2026