@@ -58,23 +58,24 @@ public ClientStore(IConfigurationDbContext context, ILogger<ClientStore> logger,
5858 /// </returns>
5959 public virtual async Task < Duende . IdentityServer . Models . Client > FindClientByIdAsync ( string clientId )
6060 {
61- IQueryable < Entities . Client > baseQuery = Context . Clients
62- . Where ( x => x . ClientId == clientId ) ;
61+ var query = Context . Clients
62+ . Where ( x => x . ClientId == clientId )
63+ . Include ( x => x . AllowedCorsOrigins )
64+ . Include ( x => x . AllowedGrantTypes )
65+ . Include ( x => x . AllowedScopes )
66+ . Include ( x => x . Claims )
67+ . Include ( x => x . ClientSecrets )
68+ . Include ( x => x . IdentityProviderRestrictions )
69+ . Include ( x => x . PostLogoutRedirectUris )
70+ . Include ( x => x . Properties )
71+ . Include ( x => x . RedirectUris )
72+ . AsNoTracking ( )
73+ . AsSplitQuery ( ) ;
6374
64- var client = ( await baseQuery . ToArrayAsync ( ) )
65- . SingleOrDefault ( x => x . ClientId == clientId ) ;
75+ var client = ( await query . ToArrayAsync ( CancellationTokenProvider . CancellationToken ) ) .
76+ SingleOrDefault ( x => x . ClientId == clientId ) ;
6677 if ( client == null ) return null ;
6778
68- await baseQuery . Include ( x => x . AllowedCorsOrigins ) . SelectMany ( c => c . AllowedCorsOrigins ) . LoadAsync ( ) ;
69- await baseQuery . Include ( x => x . AllowedGrantTypes ) . SelectMany ( c => c . AllowedGrantTypes ) . LoadAsync ( ) ;
70- await baseQuery . Include ( x => x . AllowedScopes ) . SelectMany ( c => c . AllowedScopes ) . LoadAsync ( ) ;
71- await baseQuery . Include ( x => x . Claims ) . SelectMany ( c => c . Claims ) . LoadAsync ( ) ;
72- await baseQuery . Include ( x => x . ClientSecrets ) . SelectMany ( c => c . ClientSecrets ) . LoadAsync ( ) ;
73- await baseQuery . Include ( x => x . IdentityProviderRestrictions ) . SelectMany ( c => c . IdentityProviderRestrictions ) . LoadAsync ( ) ;
74- await baseQuery . Include ( x => x . PostLogoutRedirectUris ) . SelectMany ( c => c . PostLogoutRedirectUris ) . LoadAsync ( ) ;
75- await baseQuery . Include ( x => x . Properties ) . SelectMany ( c => c . Properties ) . LoadAsync ( ) ;
76- await baseQuery . Include ( x => x . RedirectUris ) . SelectMany ( c => c . RedirectUris ) . LoadAsync ( ) ;
77-
7879 var model = client . ToModel ( ) ;
7980
8081 Logger . LogDebug ( "{clientId} found in database: {clientIdFound}" , clientId , model != null ) ;
0 commit comments