@@ -19,15 +19,18 @@ public static class RpcFilterUtils
1919 /// <returns></returns>
2020 public static List < RpcFilterAttribute > GetFilterAttributes ( RpcContext aspectContext , IServiceProvider serviceProvider , IEnumerable < Type > filterTypes )
2121 {
22- var methondInfo = aspectContext . Method ;
22+ var methodInfo = aspectContext . Method ;
23+ var reflectedTypeHandle = methodInfo . ReflectedType ! . TypeHandle . Value ;
24+ var methodHandle = methodInfo . MethodHandle . Value ;
25+ var methodKey = $ "{ reflectedTypeHandle } _{ methodHandle } ";
2326
24- var methondInterceptorAttributes = _methodFilters . GetOrAdd ( $ " { methondInfo . DeclaringType . FullName } # { methondInfo . Name } " ,
27+ var methondInterceptorAttributes = _methodFilters . GetOrAdd ( methodKey ,
2528 key =>
2629 {
27- var methondAttributes = methondInfo . GetCustomAttributes ( true )
30+ var methondAttributes = methodInfo . GetCustomAttributes ( true )
2831 . Where ( i => typeof ( RpcFilterAttribute ) . IsAssignableFrom ( i . GetType ( ) ) )
2932 . Cast < RpcFilterAttribute > ( ) . ToList ( ) ;
30- var classAttributes = methondInfo . DeclaringType . GetCustomAttributes ( true )
33+ var classAttributes = methodInfo . DeclaringType . GetCustomAttributes ( true )
3134 . Where ( i => typeof ( RpcFilterAttribute ) . IsAssignableFrom ( i . GetType ( ) ) )
3235 . Cast < RpcFilterAttribute > ( ) ;
3336 //获取方法filter
@@ -68,7 +71,7 @@ private static void PropertiesInject(IServiceProvider serviceProvider, IEnumerab
6871
6972 private static void PropertieInject ( IServiceProvider serviceProvider , RpcFilterAttribute rpcFilterAttribute )
7073 {
71- var properties = _filterFromServices . GetOrAdd ( $ "{ rpcFilterAttribute . GetType ( ) . FullName } ", key => rpcFilterAttribute . GetType ( ) . GetProperties ( BindingFlags . Instance | BindingFlags . Public | BindingFlags . NonPublic ) . Where ( i => i . GetCustomAttribute < FromServicesAttribute > ( ) != null ) ) ;
74+ var properties = _filterFromServices . GetOrAdd ( $ "{ rpcFilterAttribute . GetType ( ) . TypeHandle . Value } ", key => rpcFilterAttribute . GetType ( ) . GetProperties ( BindingFlags . Instance | BindingFlags . Public | BindingFlags . NonPublic ) . Where ( i => i . GetCustomAttribute < FromServicesAttribute > ( ) != null ) ) ;
7275 if ( properties . Any ( ) )
7376 {
7477 foreach ( var propertyInfo in properties )
0 commit comments