@@ -190,6 +190,16 @@ private RouteEndpointBuilder CreateRouteEndpointBuilder(
190190 RequestDelegateFactoryOptions ? rdfOptions = null ;
191191 RequestDelegateMetadataResult ? rdfMetadataResult = null ;
192192
193+ // Any metadata inferred directly inferred by RDF or indirectly inferred via IEndpoint(Parameter)MetadataProviders are
194+ // considered less specific than method-level attributes and conventions but more specific than group conventions
195+ // so inferred metadata gets added in between these. If group conventions need to override inferred metadata,
196+ // they can do so via IEndpointConventionBuilder.Finally like the do to override any other entry-specific metadata.
197+ if ( isRouteHandler )
198+ {
199+ rdfOptions = CreateRdfOptions ( entry , pattern , builder ) ;
200+ rdfMetadataResult = InferHandlerMetadata ( entry . RouteHandler . Method , rdfOptions ) ;
201+ }
202+
193203 // Add delegate attributes as metadata before entry-specific conventions but after group conventions.
194204 var attributes = handler . Method . GetCustomAttributes ( ) ;
195205 if ( attributes is not null )
@@ -209,16 +219,6 @@ private RouteEndpointBuilder CreateRouteEndpointBuilder(
209219 // If no convention has modified builder.RequestDelegate, we can use the RequestDelegate returned by the RequestDelegateFactory directly.
210220 var conventionOverriddenRequestDelegate = ReferenceEquals ( builder . RequestDelegate , redirectRequestDelegate ) ? null : builder . RequestDelegate ;
211221
212- // Any metadata inferred directly inferred by RDF or indirectly inferred via IEndpoint(Parameter)MetadataProviders are
213- // considered less specific than method-level attributes and conventions but more specific than group conventions
214- // so inferred metadata gets added in between these. If group conventions need to override inferred metadata,
215- // they can do so via IEndpointConventionBuilder.Finally like the do to override any other entry-specific metadata.
216- if ( isRouteHandler )
217- {
218- rdfOptions = CreateRdfOptions ( entry , pattern , builder ) ;
219- rdfMetadataResult = InferHandlerMetadata ( entry . RouteHandler . Method , rdfOptions ) ;
220- }
221-
222222 if ( isRouteHandler || builder . FilterFactories . Count > 0 )
223223 {
224224 rdfOptions ??= CreateRdfOptions ( entry , pattern , builder ) ;
0 commit comments