![]() |
VOOZH | about |
dotnet add package AutoMapper.Extensions.EnumMapping --version 6.0.0
NuGet\Install-Package AutoMapper.Extensions.EnumMapping -Version 6.0.0
<PackageReference Include="AutoMapper.Extensions.EnumMapping" Version="6.0.0" />
<PackageVersion Include="AutoMapper.Extensions.EnumMapping" Version="6.0.0" />Directory.Packages.props
<PackageReference Include="AutoMapper.Extensions.EnumMapping" />Project file
paket add AutoMapper.Extensions.EnumMapping --version 6.0.0
#r "nuget: AutoMapper.Extensions.EnumMapping, 6.0.0"
#:package AutoMapper.Extensions.EnumMapping@6.0.0
#addin nuget:?package=AutoMapper.Extensions.EnumMapping&version=6.0.0Install as a Cake Addin
#tool nuget:?package=AutoMapper.Extensions.EnumMapping&version=6.0.0Install as a Cake Tool
👁 CI
👁 NuGet
👁 NuGet
👁 MyGet (dev)
The AutoMapper.Extensions.EnumMapping library gives you control about your enum values mappings. It is possible to create a custom type converter for every enum.
This library supports mapping enums values like properties.
You should install AutoMapper.Extensions.EnumMapping with NuGet:
Install-Package AutoMapper.Extensions.EnumMapping
Or via the .NET Core command line interface:
dotnet add package AutoMapper.Extensions.EnumMapping
Either commands, from Package Manager Console or .NET Core CLI, will download and install AutoMapper.Extensions.EnumMapping. AutoMapper.Extensions.EnumMapping has no dependencies.
Install via NuGet first:
Install-Package AutoMapper.Extensions.EnumMapping
To use it:
For method CreateMap this library provide a ConvertUsingEnumMapping method. This method add all default mappings from source to destination enum values.
If you want to change some mappings, then you can use MapValue method. This is a chainable method.
Default the enum values are mapped by value (MapByValue()), but it is possible to map by name calling MapByName(). For enums which does not have same values and names, you can use MapByCustom(). Then you have to add a MapValue for every source enum value.
using AutoMapper.Extensions.EnumMapping;
public enum Source
{
Default = 0,
First = 1,
Second = 2
}
public enum Destination
{
Default = 0,
Second = 2
}
internal class YourProfile : Profile
{
public YourProfile()
{
CreateMap<Source, Destination>()
.ConvertUsingEnumMapping(opt => opt
// optional: .MapByValue() or MapByName(), without configuration MapByValue is used
.MapValue(Source.First, Destination.Default))
.ReverseMap(); // to support Destination to Source mapping, including custom mappings of ConvertUsingEnumMapping
}
}
...
AutoMapper provides a nice tooling for validating typemaps. This library adds an extra EnumMapperConfigurationExpressionExtensions.EnableEnumMappingValidation extension method to extend the existing AssertConfigurationIsValid() method to validate also the enum mappings.
To enable testing the enum mapping configuration:
public class MappingConfigurationsTests
{
[Fact]
public void WhenProfilesAreConfigured_ItShouldNotThrowException()
{
// Arrange
var config = new MapperConfiguration(configuration =>
{
configuration.EnableEnumMappingValidation();
configuration.AddMaps(typeof(AssemblyInfo).GetTypeInfo().Assembly);
});
// Assert
config.AssertConfigurationIsValid();
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on AutoMapper.Extensions.EnumMapping:
| Package | Downloads |
|---|---|
|
FFCEI.Microservices
A free library for ASP.NET Core 6+ Microservices development, with Model, Model Repository, Entity Framework Core and common Web Api features like CORS, Json serialization fixes, Swagger generation, JWT Authentication for simple and objective microservices development |
|
|
Dst.Common.Domain
Package Description |
|
|
VRSPRO.Common.Interfaces
A set of internal generic classes and extensions for working with caches, databases, queues, message brokers, files, reflection, errors, , pagination, collections, strings, and ASP NET CORE. You can use this code in your projects as is. You can copy, modify and distribute it without any restrictions. You do not need to provide any copyrights or references. |
|
|
IF.APM.OpenTelemetry.Data.Mapping
Package Description |
|
|
EApplication.Shared
Simple Domain for DDD ECommerce uisng |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.0 | 239,669 | 12/6/2025 |
| 5.0.0 | 103,604 | 8/26/2025 |
| 4.1.0 | 1,932,130 | 3/6/2025 |
| 4.0.0 | 184,915 | 2/17/2025 |
| 3.2.0 | 5,868,168 | 2/6/2024 |
| 3.1.0 | 3,286,174 | 4/20/2023 |
| 3.0.1 | 2,229,755 | 10/12/2022 |
| 3.0.0 | 24,157 | 10/7/2022 |
| 2.0.1 | 1,776,562 | 1/7/2022 |
| 1.1.0 | 2,996,262 | 3/5/2021 |
| 1.0.0 | 975,523 | 7/9/2020 |