Skip to main content

Enum mappings

An enum mapping can be customized by setting the strategy to use. Apply the MapEnumAttribute and pass the strategy to be used for this enum. It is also possible to set the strategy for the entire mapper via the MapperAttribute. Available strategies:

ByValueMatches enum entries by their values (default)
ByNameMatches enum entries by their exact names

The IgnoreCase property allows to opt in for case insensitive mappings (defaults to false).

Applied to all enums mapped inside this mapper.

[Mapper(EnumMappingStrategy = EnumMappingStrategy.ByName, EnumMappingIgnoreCase = true)]
public partial class CarMapper