Lightweight. Familiar. MIT Licensed. Built for .NET 8, 9, and 10.
Following AutoMapper's recent licensing changes, many .NET developers have started looking for an open-source alternative that doesn't require rewriting years of mapping code.
That's one of the reasons I built Twinify.
Twinify is a lightweight, high-performance object-to-object mapper that provides a familiar fluent API, making it easy to map DTOs, entities, view models, records, and complex object graphs while remaining completely open source under the MIT License.
If you're already using AutoMapper, you'll find the transition straightforward for many common mapping scenarios.
Why Twinify?
✔ MIT Licensed
✔ Built for .NET 8, .NET 9 & .NET 10
✔ Familiar AutoMapper-style Fluent API
✔ Dependency Injection Support
✔ Automatic Convention-Based Mapping
✔ Nested Objects & Collections
✔ Flattening
✔ Record & Constructor Mapping
✔ Mapping Diagnostics with Explain<TSource, TDestination>()
Installation
Install the required packages.
dotnet add package Twinify
dotnet add package Twinify.DependencyInjection
Step 1 — Create a Mapping Profile
Define your mappings by inheriting from MappingProfile.
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());
}
}
Twinify uses a familiar fluent configuration model that should feel natural to developers coming from AutoMapper.
Step 2 — Register Twinify
Register your mapping profiles during application startup.
builder.Services.AddTwinify(cfg =>
{
cfg.AddProfile<UserProfile>();
});
Step 3 — Map Your Objects
Inject IMapper wherever it's needed.
public class UserService(IMapper mapper)
{
public UserDto GetUser(User user)
{
return mapper.Map<UserDto>(user);
}
}
That's all you need.
Twinify automatically maps properties with matching names while allowing full customization when required.
Features
Automatic Convention Mapping
Properties with identical names are mapped automatically.
User.Name
↓
UserDto.Name
No configuration required.
Automatic Flattening
Nested properties are flattened automatically.
Source
User.Address.City
↓
Destination
UserDto.AddressCity
Nested Object Mapping
Twinify recursively maps nested object graphs.
Order
└── Customer
└── Address
└── Contacts
↓
OrderDto
└── CustomerDto
└── AddressDto
└── ContactDtos
Collection Mapping
Supports:
- Lists
- Arrays
- Dictionaries
- Nested collections
Constructor & Record Mapping
Twinify automatically constructs destination types, including:
- Immutable objects
- Records
- Parameterized constructors
Fluent Configuration
Twinify supports a rich configuration API, including:
CreateMapForMemberMapFromIgnoreConditionConvertUsingBeforeMapAfterMapReverseMapIncludeBasePreserveReferences
Explain Your Mappings
One feature that sets Twinify apart is mapping diagnostics.
mapper.Explain<User, UserDto>();
Instead of guessing why a property mapped the way it did, Explain() shows exactly where every destination member receives its value, making debugging significantly easier.
Migrating from AutoMapper
Many existing AutoMapper projects can migrate with only a few mechanical changes.
| AutoMapper | Twinify |
|---|---|
Profile |
MappingProfile |
CreateMap() |
Same familiar API |
ForMember() |
Same familiar API |
MapFrom() |
Same familiar API |
ReverseMap() |
Supported |
AddAutoMapper() |
AddTwinify() |
| Custom resolvers |
ConvertUsing() and member configuration |
Migration Guide
1. Remove AutoMapper
dotnet remove package AutoMapper
2. Install Twinify
dotnet add package Twinify
dotnet add package Twinify.DependencyInjection
3. Update Your Profiles
Replace
public class UserProfile : Profile
with
public class UserProfile : MappingProfile
4. Update Dependency Injection
Replace
builder.Services.AddAutoMapper(...);
with
builder.Services.AddTwinify(cfg =>
{
cfg.AddProfile<UserProfile>();
});
5. Build & Test
Many existing CreateMap() and ForMember() configurations should require little or no modification.
As with any migration, it's recommended to run your existing mapping tests to validate behavior.
Why I Built Twinify
I wanted a mapper that is:
- Open source
- Lightweight
- Easy to understand
- Familiar to existing AutoMapper users
- Built specifically for modern .NET
Rather than forcing developers to learn an entirely new API, Twinify focuses on keeping the transition intuitive while continuing to evolve with community feedback.
Getting Started
📦 NuGet
dotnet add package Twinify
📖 Documentation
https://github.com/StevenKamwaza/Twinify.Docs
💻 Source Code
https://github.com/StevenKamwaza/Twinify
⭐ If Twinify helps your project, consider giving the repository a star and sharing your feedback. Community contributions and feature requests are always welcome.
Happy Coding! 🚀
Built with ❤️ for the .NET community.
Share Your Thoughts
Have questions, feature ideas, or migration feedback?
Open an issue or start a discussion on GitHub—I'd love to hear how you're using Twinify in your projects.

Top comments (0)