Frank.Mapping.Analyzers 1.1.11-preview

This is a prerelease version of Frank.Mapping.Analyzers.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Frank.Mapping.Analyzers --version 1.1.11-preview                
NuGet\Install-Package Frank.Mapping.Analyzers -Version 1.1.11-preview                
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.Analyzers" Version="1.1.11-preview" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Frank.Mapping.Analyzers --version 1.1.11-preview                
#r "nuget: Frank.Mapping.Analyzers, 1.1.11-preview"                
#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.Analyzers as a Cake Addin
#addin nuget:?package=Frank.Mapping.Analyzers&version=1.1.11-preview&prerelease

// Install Frank.Mapping.Analyzers as a Cake Tool
#tool nuget:?package=Frank.Mapping.Analyzers&version=1.1.11-preview&prerelease                

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

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.2.0 136 8/25/2024
1.1.11-preview 102 8/25/2024