File tree Expand file tree Collapse file tree
AuthorizationChecker/src/Extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,20 @@ public static IServiceCollection AddAuthorizationChecker(this IServiceCollection
1818
1919 foreach ( var voterType in voterTypes )
2020 {
21- foreach ( var voterInterface in voterType . GetInterfaces ( ) . Where ( type => type . IsGenericType && type . GetGenericTypeDefinition ( ) == typeof ( IVoter < > ) ) )
21+ var voterTypeInterfaces = new HashSet < Type > ( ) ;
22+ var currentType = voterType ;
23+
24+ while ( currentType != null && currentType != typeof ( object ) )
25+ {
26+ foreach ( var @interface in currentType . GetInterfaces ( ) )
27+ {
28+ voterTypeInterfaces . Add ( @interface ) ;
29+ }
30+
31+ currentType = currentType . BaseType ;
32+ }
33+
34+ foreach ( var voterInterface in voterTypeInterfaces . Where ( type => type . IsGenericType ) )
2235 {
2336 services . AddTransient ( voterInterface , voterType ) ;
2437 }
You can’t perform that action at this time.
0 commit comments