Skip to content

Enable opt-in to case-insensitive mapping of enums #7

@earloc

Description

@earloc

In vanilla AM, with the default behavior of EnumToEnumMapper, we have a mechanism in place that gracefully handles situations where differences in the naming of enum-values ar present.

For instance, mapping between these two enums is a no brainer:

public enum Source {
   bar,
   foo,
   foobar
}

public enum Destination {
   FOO,
   FooBar,
   BAR
}

However, when we leverage customization of mappings, we completely loose this convenience, when all we need is to customize a single or a few couple of enum-values.

Proposal:
Extend IEnumConfigurationExpression.MapByName to take an optional boolean parameter to control the internal behavior.
Default value would be false, as this should be the most back-wards-compatible introduction for this.

IEnumConfigurationExpression<TSource, TDestination> MapByName(bool ignoreCase = false);

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions