Add the option to ignore source / target enum values from enum mappings.
This is especially useful in context of #325 (to ignore an expected unmapped enum member).
enum Fruit { Apple, Kiwi }
enum FruitDto { Apple, Banana }
// declaration
[Mapper]
public partial DtoMapper
{
[MapEnum(EnumMappingStrategy.ByName)]
[MapperIgnoreSource(Fruit.Kiwi)]
[MapperIgnoreTarget(FruitDto.Banana)]
public partial FruitDto ToDto(Fruit source);
}
// implementation
public partial DtoMapper
{
public partial FruitDto ToDto(Fruit source)
{
return source switch
{
Fruit.Apple => FruitDto.Apple,
_ => throw new ...
};
}
}
Add the option to ignore source / target enum values from enum mappings.
This is especially useful in context of #325 (to ignore an expected unmapped enum member).