MapperToolkit 1.0.1.8-alpha

This is a prerelease version of MapperToolkit.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package MapperToolkit --version 1.0.1.8-alpha
                    
NuGet\Install-Package MapperToolkit -Version 1.0.1.8-alpha
                    
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="MapperToolkit" Version="1.0.1.8-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MapperToolkit" Version="1.0.1.8-alpha" />
                    
Directory.Packages.props
<PackageReference Include="MapperToolkit" />
                    
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 MapperToolkit --version 1.0.1.8-alpha
                    
#r "nuget: MapperToolkit, 1.0.1.8-alpha"
                    
#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 MapperToolkit@1.0.1.8-alpha
                    
#: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=MapperToolkit&version=1.0.1.8-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MapperToolkit&version=1.0.1.8-alpha&prerelease
                    
Install as a Cake Tool

MapperToolkit

Nuget GitHub

This project is a Mapper library use Source Generator with function such as:

  • mapper: object-object mapper .
  • transoform:by object (entity) build specified model (DTO) .

MapperToolkit is the fastest .NET object mapper if member inclube List IEnumerable surpassing even the manual mapping and Mapperly The benchmark was generated with(https://github.com/GaoNian-NET/Benchmark.netCoreMappers).

Method Mean Error StdDev Gen 0 Gen 1 Allocated
AgileMapper 2,832.5 ns 56.29 ns 80.73 ns 0.5035 0.0038 3 KB
TinyMapper 3,195.5 ns 62.88 ns 113.39 ns 0.3853 - 2 KB
ExpressMapper 2,957.5 ns 84.74 ns 248.54 ns 0.8049 0.0038 5 KB
AutoMapper 1,497.6 ns 33.87 ns 98.79 ns 0.3452 0.0019 2 KB
ManualMapping 459.0 ns 14.02 ns 41.13 ns 0.2103 0.0005 1 KB
Mapster 465.3 ns 13.84 ns 40.60 ns 0.3285 0.0019 2 KB
Mapperly 484.8 ns 9.02 ns 16.71 ns 0.2613 0.0010 2 KB
MapperToolkit 303.2 ns 6.11 ns 5.10 ns 0.1884 0.0005 1 KB

Quickstart

Installation

Add the NuGet Package to your project:

dotnet add package MapperToolkit

Create your first mapper

//example Entity
public class Entity
{
    public string Account { get; set; }
    public DateTime CreateTime { get; set; }
}

//example DTO
public class DTO
{
    public string EmpNo { get; set; }
    public string EmpName { get; set; }
    public DateTime CreateTime { get; set; }
}

Create profile class inherit MapperToolkit.Profile in constructors type mapper code

// Profile declaration
public class MappingProfile : Profile
{
    public MappingProfile()
    {
        GenerateAllMapper<Entity, DTO>()
        .Map(src => src.Account[0..4],dest=>dest.EmpNo)
        .Map(src => src.Account[4..^0],dest=>dest.EmpName);
    }
}

//Generator code
 public static partial class DTOMapper
{
    public static global::ConsoleApp.DTO MapperToDTO(this global::ConsoleApp.Entity source)
    {
        global::ConsoleApp4.DTO result = new();
        global::System.Func<global::ConsoleApp.Entity, string> EmpNoMapper = src => src.Account[0..4];
        global::System.Func<global::ConsoleApp.Entity, string> EmpNameMapper = src => src.Account[4..^0];
        result.EmpNo = EmpNoMapper.Invoke(source);
        result.EmpName = EmpNameMapper.Invoke(source);
        result.CreateTime = source.CreateTime;
        return result;
    }
}
//Mapper usage
var entity = new Entity() { Account = "A123Bojack" ,CreateTime = DateTime.Now };
var dto = entity.MapperToDTO();
Console.WriteLine($"EmpNo:{dto.EmpNo};EmpName:{dto.EmpName};CreateTime:{dto.CreateTime}");
// print EmpNo:A123;EmpName:Bojack;CreateTime:2022/8/16 12:13:15
Product 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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.
  • .NETStandard 2.1

    • 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