Frank.Mapping 1.2.0

dotnet add package Frank.Mapping --version 1.2.0                
NuGet\Install-Package Frank.Mapping -Version 1.2.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="Frank.Mapping" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Frank.Mapping --version 1.2.0                
#r "nuget: Frank.Mapping, 1.2.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.
// Install Frank.Mapping as a Cake Addin
#addin nuget:?package=Frank.Mapping&version=1.2.0

// Install Frank.Mapping as a Cake Tool
#tool nuget:?package=Frank.Mapping&version=1.2.0                

Frank.Mapping

A simple mapping library


GitHub License NuGet NuGet

GitHub contributors GitHub Release Date - Published_At GitHub last commit GitHub commit activity GitHub pull requests GitHub issues GitHub closed issues


Installation

NuGet

Install-Package Frank.Mapping

Usage

Create a mapping

private class MyMappingDefinition : IMappingDefinition<From, To>
{
    public To Map(From from)
    {
        return new()
        {
            Id = from.Id,
            Name = $"{from.FirstName} {from.LastName}"
        };
    }
}

Register the mapping

var serviceProvider = new ServiceCollection()
    .AddMappingDefinition<From, To, MyMappingDefinition>()
    .BuildServiceProvider();

Consuming the mapping through dependency injection

// Option 1: Directly
public class MyService
{
    private readonly IMappingDefinition<From, To> _mappingDefinition;
    
    public MyService(IMappingDefinition<From, To> mappingDefinition)
    {
        _mappingDefinition = mappingDefinition;
    }
    
    public void DoSomething(From from)
    {
        var to = _mappingDefinition.Map(from);
        
        // Do something with the mapped object
    }
}

// Option 2: Through a mappingprovider
public class MyService
{
    private readonly IMappingProvider _mappingProvider;
    
    public MyService(IMappingProvider mappingProvider)
    {
        _mappingProvider = mappingProvider;
    }
    
    public void DoSomething(From from)
    {
        var to = _mappingProvider.Map<From, To>(from);
        
        // Do something with the mapped object
    }
}
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. 
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 Frank.Mapping:

Package Downloads
Frank.Mapping.Analyzers

Package Description

Frank.WorkflowEngine

Package Description

Frank.Mapping.CodeGeneratin

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 132 8/25/2024
1.1.11-preview 121 8/25/2024
1.1.5-preview 99 8/24/2024
1.1.4-preview 93 8/24/2024
1.1.3-preview 93 5/26/2024
1.1.2-preview 104 5/25/2024
1.1.0 152 1/27/2024
1.0.0 168 1/2/2024