Twinify.DependencyInjection 1.0.2

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

<p align="center"> <img src="https://raw.githubusercontent.com/StevenKamwaza/Twinify.Docs/master/logo-full.png" width="96" height="96" alt="Twinify logo" /> </p>

<h1 align="center">Twinify</h1> <p align="center"><b>Object mapping made simple.</b></p>

.NET Support NuGet Version NuGet Downloads License: MIT

Twinify copies values from one object to another so you don't have to write that code by hand. Describe the shape of the mapping once, then call Map<T>() wherever you need it.

var dto = mapper.Map<UserDto>(user);

Install

dotnet add package Twinify
dotnet add package Twinify.DependencyInjection

Quick start

1. Describe your mapping in a profile:

public class UserProfile : MappingProfile
{
    public UserProfile()
    {
        CreateMap<User, UserDto>()
            .ForMember(d => d.FullName, opt => opt.MapFrom(s => $"{s.FirstName} {s.LastName}"))
            .ForMember(d => d.Password, opt => opt.Ignore());
    }
}

2. Register it:

builder.Services.AddTwinify(cfg =>
{
    cfg.AddProfile<UserProfile>();
});

3. Use it:

public class UserService(IMapper mapper)
{
    public UserDto GetUser(User user) => mapper.Map<UserDto>(user);
}

That's it - properties with matching names are copied automatically. Anything you want to customize (rename, compute, ignore, convert) gets a line in the profile.

What it handles for you

  • Auto-matching - properties with the same name copy across without any configuration.
  • Flattening - a destination property like AddressCity automatically picks up source.Address.City.
  • Nested objects and collections - lists, arrays, dictionaries, and nested objects map recursively.
  • Custom logic - ForMember, Ignore, Condition, MapFrom, BeforeMap/AfterMap, ConvertUsing, and more, for the cases that need more than a straight copy.
  • Constructors and records - Twinify works out how to construct your destination type, including types with only a parameterized constructor.
  • Explain<TSource, TDestination>() - prints exactly where every destination member's value comes from, for when a mapping doesn't do what you expected.

Packages

Package What it's for
Twinify.Abstractions The types you write against: IMapper, MappingProfile, CreateMap, etc.
Twinify The mapping engine that actually executes your maps.
Twinify.DependencyInjection AddTwinify(...) and friends, for ASP.NET Core / generic host apps.

Learn more

See the project repository for a deeper look at how the mapping engine is put together, and more examples of the full configuration surface (ReverseMap, IncludeBase, PreserveReferences, value resolvers, and so on).

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 is compatible.  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.0.2 86 8/7/2026
1.0.1 78 8/7/2026
1.0.0 104 7/13/2026