FreeMapper 1.3.8

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

FreeMapper nuget

Table of contents

About

  • Quick summary

    This is free mapper between 2 c# objects, something like AutoMapper but lightweight. It doesn't need a mapping profile to work and don't throw exceptions for missing mapping profiles.

  • Targeted framework

    .net8, .net10

  • Version

    1.3.8

Installation

Add 'FreeMapper' nuget to project

Usage

Implementation

Implementation is very simple, you can use dependency injection or call initialization manually. You don't need a mapping profile, if something cannot be mapped it is only skipped. If you don't have configuration, than fields in objects are mapped by name and type. To implement a mapping profile you need to inherit FreeMapperProfileBase class and use Add<Destination, Source>() method in constructor to add class mappings. If source definition has only member expression (x=>x.Name) and member points to class, mapper automatically searches for profile definition for that class.

There are 4 initialization methods:

  • FreeMapper.Mapper() - slowest one, in background searches all assemblies for mapping configurations
  • FreeMapper.Mapper(Action<FreeMapperConfiguration> configuration) - same as above but with configuration
  • FreeMapper.Mapper(Type t) - fast one, in background searches only assembly with defined type
  • FreeMapper.Mapper() - same as above but with configuration

Mapper configuration exposes 4 options:

  • CaseSensitiveMap - if true, property mapping is case sensitive (when map configuration is not present)(default true)
  • MapDestinationPublicFields - if true, public fields + properties of destination are mapped(default false), properties are always mapped
  • MapSourcePublicFields - if true, public fields + properties of source are mapped(default false), properties are always mapped
  • UseAutomaticDeepMap - if true, child properties of object type are automatically mapped, if false configuration is needed(default true)

Mapper.Map function has overloaded members with posibility to set above configuration fields per call. It is possible to ignore destination fields with IgnoreField mapping function. Supported types: value types + DateTime + TimeSpan + Guid, IEnumerable + Array, Dictionary, KeyValuPair, Class/Struct (with public fields/properties).

This is example of implementation of profile:

    ```
    public class MyMappingProfile : FreeMapperProfileBase
    {
        public MyMappingProfile()
        {
            Add<Class1, Class2>()
                .AddField(dest => dest.Field1, src => src.SomeField)
                .AddField(dest => dest.ChildClass, src => src.SomeChildClass);
            Add<ChildClass, SomeChildClass>()
                .AddField(dest => dest.Field3, src => src.Field2)
        }

        public string GetWeatherForecast([Required] string from, string to)
        {
                ...
        }
        ...
    }
    ```

This is example of manual initialization and usage, for example in console project:

    ```
    Console.WriteLine("Hello, World!");
    var mapper = new FreeMapper.Mapper();
    var result = mapper.Map<SomeClass>(SomeObject);
    ```

This is example of dependency injection initialization and usage, for example in API project:

    ```
    var builder = WebApplication.CreateBuilder(args);
    builder.Services.AddFreeMapper();
    ```
  • Microsoft.Extensions.DependencyInjection.Abstractions

Contact and Contribute

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 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
1.3.8 100 5/15/2026
1.3.7 106 4/7/2026
1.3.6 104 3/26/2026
1.3.5 96 3/26/2026
1.3.4 104 3/9/2026
1.3.3 117 1/27/2026
1.3.2 111 1/25/2026
1.3.1 111 1/25/2026
1.2.1 121 1/23/2026
1.1.1 121 1/23/2026
1.1.0 113 1/23/2026
1.0.9 119 1/22/2026
1.0.8 120 1/22/2026
1.0.7 112 1/22/2026
1.0.6 117 1/21/2026
1.0.5 116 1/18/2026
1.0.4 111 1/15/2026
1.0.3 117 1/15/2026
1.0.2 122 1/14/2026
1.0.1 122 1/13/2026
Loading failed