Midas.Mapper
1.0.10
dotnet add package Midas.Mapper --version 1.0.10
NuGet\Install-Package Midas.Mapper -Version 1.0.10
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="Midas.Mapper" Version="1.0.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Midas.Mapper" Version="1.0.10" />
<PackageReference Include="Midas.Mapper" />
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 Midas.Mapper --version 1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Midas.Mapper, 1.0.10"
#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 Midas.Mapper@1.0.10
#: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=Midas.Mapper&version=1.0.10
#tool nuget:?package=Midas.Mapper&version=1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Midas.Mapper
Lightweight, explicit object mapper for .NET with zero convention magic.
Built by Midas Path Software Solutions for clean-architecture healthcare systems.
Why Midas.Mapper?
| Feature | AutoMapper | Midas.Mapper |
|---|---|---|
| Convention-based | ✅ (can surprise you) | ❌ (explicit only) |
| DI-native | Partial | ✅ Full |
| Debuggable | Hard | ✅ Plain C# |
| Bidirectional | Config-based | ✅ IBidirectionalMapper<,> |
| Source-generated | ❌ | ✅ [GenerateMapper] auto-registers |
| Collection mapping | Manual | ✅ MapList<,>() built-in |
Installation
dotnet add package Midas.Mapper
Quick Start
1. Implement a mapper
using Midas.Mapper;
[GenerateMapper] // auto-discovered by AddMidasMappers()
public class PatientMapper : IMapper<Patient, PatientDto>
{
public PatientDto Map(Patient source) => new(
Id: source.Id,
FullName: source.FullName,
DateOfBirth: source.DateOfBirth
);
}
2. Register in Program.cs (once)
builder.Services.AddMidasMappers(
typeof(PatientMapper).Assembly // pass every assembly that contains mappers
);
3. Inject and use
public class MyHandler(MapperRegistry mapper)
{
public PatientDto Handle(Patient patient)
=> mapper.Map<Patient, PatientDto>(patient);
public IReadOnlyList<PatientDto> HandleList(IEnumerable<Patient> patients)
=> mapper.MapList<Patient, PatientDto>(patients);
}
Bidirectional Mapping
[GenerateMapper]
public class AppointmentMapper : IBidirectionalMapper<Appointment, AppointmentDto>
{
public AppointmentDto Map(Appointment source) => new(...);
public Appointment ReverseMap(AppointmentDto dto) => new(...);
}
// Usage
var dto = mapper.Map<Appointment, AppointmentDto>(appointment);
var back = mapper.ReverseMap<Appointment, AppointmentDto>(dto);
How Auto-Discovery Works
AddMidasMappers() scans the provided assemblies via reflection at startup:
- Finds every class decorated with
[GenerateMapper] - Registers each
IMapper<TSource, TDestination>interface it implements as a scoped DI service - Registers
MapperRegistryas a singleton that resolves mappers from the DI container
No code generation. No IL emit. Plain reflection — once at startup.
Target Frameworks
net9.0
License
| Product | Versions 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.
-
net10.0
-
net8.0
-
net9.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.