File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/AspNetCore/WebApi/src/Asp.Versioning.Mvc Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 22
33namespace Asp . Versioning ;
44
5+ using Asp . Versioning . ApplicationModels ;
56using Asp . Versioning . Conventions ;
67using Microsoft . AspNetCore . Mvc . Abstractions ;
8+ using Microsoft . AspNetCore . Mvc . ApplicationModels ;
79using Microsoft . AspNetCore . Mvc . Controllers ;
810using System . Runtime . CompilerServices ;
911using static Asp . Versioning . ApiVersionMapping ;
@@ -102,13 +104,22 @@ protected virtual string GetControllerName( ActionDescriptor action )
102104 return NamingConvention . GroupName ( name ) ;
103105 }
104106
107+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
108+ private static bool IsUnversioned ( ActionDescriptor action ) => action . GetApiVersionMetadata ( ) == ApiVersionMetadata . Empty ;
109+
105110 private IEnumerable < IReadOnlyList < ActionDescriptor > > GroupActionsByController ( IList < ActionDescriptor > actions )
106111 {
107112 var groups = new Dictionary < string , List < ActionDescriptor > > ( StringComparer . OrdinalIgnoreCase ) ;
108113
109114 for ( var i = 0 ; i < actions . Count ; i ++ )
110115 {
111116 var action = actions [ i ] ;
117+
118+ if ( IsUnversioned ( action ) )
119+ {
120+ continue ;
121+ }
122+
112123 var key = GetControllerName ( action ) ;
113124
114125 if ( string . IsNullOrEmpty ( key ) )
You can’t perform that action at this time.
0 commit comments