MorphMapper is a lightweight and efficient object-to-object mapping library for .NET 9. It simplifies the process of transferring data between different types with minimal configuration. Say goodbye to repetitive manual mapping code and embrace the elegance of automatic property mapping.
- Automatic Property Mapping: Maps properties with the same name and compatible types by default.
- Type Conversion: Handles automatic conversion between compatible types.
- Ignoring Properties: Easily exclude specific properties from the mapping process.
- Lightweight and Performant: Designed with efficiency in mind, minimizing overhead.
- .NET 9 Support: Built specifically for the latest .NET runtime.
Coming soon: You can install MorphMapper via NuGet Package Manager:
Install-Package MorphMapper
Initialize the mapper and the configuration
var mapperConfig = new MapperConfiguration(Assembly.GetExecutingAssembly());
var mapper = new Mapper(mapperConfig);
var result = mapper.Map<HouseDto, House>(sourceObjectMock);
In the HouseMapper.cs just override the Configure method
public class HouseMapper : Mapping<HouseDto, House>
{
public override Mapping<HouseDto, House> Configure(Mapping<HouseDto, House> mapping)
{
mapping.ForMember(x => x.Id, y => y.MapFrom(x => x.Id));
mapping.ForMember(x => x.Name, y => y.MapFrom(x => x.Name));
mapping.ForMember(x => x.Description, y => y.MapFrom(x => x.Description));
return mapping;
}
}
Contributions are more then welcome, please feel free to submit pull requests, report issues, or suggest new features.
MorphMapper is licensed under the MIT License.