Skip to content

Commit

Permalink
fix: add AllowMultiple into MapEnumValueAttribute
Browse files Browse the repository at this point in the history
  • Loading branch information
trejjam committed Aug 22, 2023
1 parent a5f6aef commit 324af53
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Riok.Mapperly.Abstractions/MapEnumValueAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Riok.Mapperly.Abstractions;
/// <summary>
/// Customizes how enum values are mapped
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class MapEnumValueAttribute : Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ public enum TestEnumDtoAdditionalValue
Value20 = 20,
Value30 = 30,
Value40 = 40,
Value50 = 50,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ public static void MapExistingList(List<string> src, List<int> dst)

[MapEnum(EnumMappingStrategy.ByName)]
[MapEnumValue(TestEnumDtoAdditionalValue.Value40, TestEnum.Value30)]
[MapEnumValue(TestEnumDtoAdditionalValue.Value50, TestEnum.Value30)]
public static partial TestEnum MapToEnumByNameWithExplicit(TestEnumDtoAdditionalValue v);

[MapEnum(EnumMappingStrategy.ByValue)]
[MapEnumValue(TestEnumDtoAdditionalValue.Value40, TestEnum.Value30)]
[MapEnumValue(TestEnumDtoAdditionalValue.Value50, TestEnum.Value30)]
public static partial TestEnum MapToEnumByValueWithExplicit(TestEnumDtoAdditionalValue v);

[MapEnum(EnumMappingStrategy.ByName)]
Expand Down

0 comments on commit 324af53

Please sign in to comment.