ForgeMap 1.3.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package ForgeMap --version 1.3.0
NuGet\Install-Package ForgeMap -Version 1.3.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="ForgeMap" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ForgeMap" Version="1.3.0" />
<PackageReference Include="ForgeMap" />
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 ForgeMap --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ForgeMap, 1.3.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 ForgeMap@1.3.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=ForgeMap&version=1.3.0
#tool nuget:?package=ForgeMap&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ForgeMap
A lightweight, MIT-licensed, source-generator-based object transformation library for .NET. ForgeMap generates type conversion code at compile time, providing zero-reflection runtime execution with compile-time type safety.
Features
- Source Generator - Compile-time code generation, no runtime reflection
- Zero Overhead - Generated code is as fast as hand-written code
- Type Safe - Compile-time validation of mappings
- Debuggable - Generated code is readable and debuggable
- MIT License - Fully open source, no commercial restrictions
Installation
dotnet add package ForgeMap
Quick Start
using ForgeMap;
// 1. Define your types
public class OrderEntity
{
public string Id { get; set; }
public string CustomerName { get; set; }
public DateTime OrderDate { get; set; }
}
public class OrderDto
{
public string Id { get; set; }
public string CustomerName { get; set; }
public DateTime OrderDate { get; set; }
}
// 2. Create a forger class
[ForgeMap]
public partial class AppForger
{
public partial OrderDto Forge(OrderEntity source);
}
// 3. Use it
var forger = new AppForger();
var dto = forger.Forge(entity);
Performance
ForgeMap is the fastest in benchmarks against AutoMapper and Mapperly (.NET 9, AMD EPYC 7763):
| Scenario | ForgeMap | Mapperly | AutoMapper |
|---|---|---|---|
| Simple (10 props) | 14.5 ns | 15.9 ns (1.1x) | 80.7 ns (5.6x) |
| Nested (2 levels) | 27.3 ns | 30.7 ns (1.1x) | 92.5 ns (3.4x) |
| Deep (4 levels) | 31.3 ns | 35.8 ns (1.1x) | 247.0 ns (7.9x) |
| Collection (1000) | 17.7 us | 20.1 us (1.1x) | 22.2 us (1.3x) |
See benchmarks/BENCHMARK_RESULTS.md for full details.
Documentation
See SPEC.md for the full specification.
Version Roadmap
| Version | Key Features |
|---|---|
| v1.0 | Core generator, property matching, collections, enums, constructor mapping, flattening, [ReverseForge], hooks, DI integration, full diagnostics |
| v1.1 | Mapping inheritance, [IncludeBaseForge], [ForgeAllDerived] polymorphic dispatch |
| v1.2 | Null-safe property assignment: NullPropertyHandling with 4 strategies, three-tier config |
| v1.3 | Auto-wiring nested & collection mappings, abstract destination dispatch for [ForgeAllDerived] |
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has 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.