OttoMapper.Extensions
1.0.2
dotnet add package OttoMapper.Extensions --version 1.0.2
NuGet\Install-Package OttoMapper.Extensions -Version 1.0.2
<PackageReference Include="OttoMapper.Extensions" Version="1.0.2" />
<PackageVersion Include="OttoMapper.Extensions" Version="1.0.2" />
<PackageReference Include="OttoMapper.Extensions" />
paket add OttoMapper.Extensions --version 1.0.2
#r "nuget: OttoMapper.Extensions, 1.0.2"
#:package OttoMapper.Extensions@1.0.2
#addin nuget:?package=OttoMapper.Extensions&version=1.0.2
#tool nuget:?package=OttoMapper.Extensions&version=1.0.2
OttoMapper
OttoMapper is a fast object mapping library for .NET with an API that is intentionally close to common AutoMapper usage patterns.
Why "Otto"?
Otto is a quintessentially German name — and so is the author. OttoMapper is a lightweight alternative to AutoMapper, so think of it as the Teutonic take on object mapping. A pun, basically.
Packages
OttoMapper.Mapping- core mapping engineOttoMapper.Extensions- dependency injection integration for ASP.NET Core
Features
CreateMap<TSource, TDestination>()ProfilesupportRequireExplicitMapsAssertConfigurationIsValid()- nested mapping
- collection mapping
ForMember(..., opt => opt.MapFrom(...))Ignore()Condition(...)NullSubstitute(...)ReverseMap()ForPath(...)BeforeMap(...)andAfterMap(...)ConvertUsing(...)ConstructUsing(...)Map<TDestination>(object source)
Basic usage
var config = new MapperConfiguration(cfg =>
{
cfg.RequireExplicitMaps = true;
cfg.CreateMap<AddressSource, AddressDestination>();
cfg.CreateMap<OrderSource, OrderDestination>()
.ForMember(d => d.Name, opt => opt.MapFrom(s => s.DisplayName))
.ForMember(d => d.Description, opt =>
{
opt.Condition(s => !string.IsNullOrWhiteSpace(s.Description));
opt.NullSubstitute("n/a");
opt.MapFrom(s => s.Description);
})
.ReverseMap();
});
config.AssertConfigurationIsValid();
var mapper = config.BuildMapper();
var dto = mapper.Map<OrderDestination>(source);
ASP.NET Core
builder.Services.AddOttoMapper(typeof(MyProfile).Assembly);
or
builder.Services.AddOttoMapper(cfg =>
{
cfg.RequireExplicitMaps = true;
}, typeof(MyProfile).Assembly);
Notes
OttoMapper is not a drop-in replacement for AutoMapper. It targets API compatibility with AutoMapper 14 for the most common mapping scenarios — CreateMap, profiles, ForMember/ForPath, conditions, reverse maps, hooks, nested and collection mapping — but it deliberately does not aim for full feature parity. If your project uses only the common subset of AutoMapper 14's API, migrating to OttoMapper should require minimal effort.
License
OttoMapper is licensed under the MIT License. See the LICENSE file in the repository root for the full license text.
Repository
| 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- OttoMapper.Mapping (>= 1.0.2)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- OttoMapper.Mapping (>= 1.0.2)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- OttoMapper.Mapping (>= 1.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Updated dependency to OttoMapper.Mapping 1.0.2 with case-insensitive and underscore-ignoring property mapping support.