File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
src/Grpc/JsonTranscoding/src/Microsoft.AspNetCore.Grpc.JsonTranscoding/Internal/Json Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,6 @@ namespace Microsoft.AspNetCore.Grpc.JsonTranscoding.Internal.Json;
1010
1111internal 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 (
You can’t perform that action at this time.
0 commit comments