Skip to content

Commit e424e1a

Browse files
committed
Update
1 parent 4a61452 commit e424e1a

File tree

1 file changed

+3
-6
lines changed
  • src/Grpc/JsonTranscoding/src/Microsoft.AspNetCore.Grpc.JsonTranscoding/Internal/Json

1 file changed

+3
-6
lines changed
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ namespace Microsoft.AspNetCore.Grpc.JsonTranscoding.Internal.Json;
1010

1111
internal static class JsonNamingHelpers
1212
{
13-
// Effectively a cache of mapping from enum values to the original name as specified in the proto file,
14-
// fetched by reflection.
1513
private static readonly ConcurrentDictionary<Type, EnumMapping> _enumMappings = new ConcurrentDictionary<Type, EnumMapping>();
1614

1715
internal static EnumValueDescriptor? GetEnumFieldReadValue(EnumDescriptor enumDescriptor, string value, GrpcJsonSettings settings)
@@ -58,19 +56,18 @@ private static EnumMapping GetEnumMapping(EnumDescriptor enumDescriptor)
5856
{
5957
if (!_enumMappings.TryGetValue(enumType, out enumMapping))
6058
{
61-
_enumMappings[enumType] = enumMapping = GetEnumMappings(enumDescriptor.Name, enumType);
59+
_enumMappings[enumType] = enumMapping = GetEnumMapping(enumDescriptor.Name, enumType);
6260
}
6361
}
6462

6563
return enumMapping;
6664
}
6765

68-
private static EnumMapping GetEnumMappings(string enumName, Type enumType)
66+
private static EnumMapping GetEnumMapping(string enumName, Type enumType)
6967
{
7068
var enumFields = enumType.GetTypeInfo().DeclaredFields
7169
.Where(f => f.IsStatic)
72-
.Where(f => f.GetCustomAttributes<OriginalNameAttribute>()
73-
.FirstOrDefault()?.PreferredAlias ?? true)
70+
.Where(f => f.GetCustomAttributes<OriginalNameAttribute>().FirstOrDefault()?.PreferredAlias ?? true)
7471
.ToList();
7572

7673
var writeMapping = enumFields.ToDictionary(

0 commit comments

Comments
 (0)