File tree 1 file changed +11
-0
lines changed
src/AspNetCore/WebApi/src/Asp.Versioning.Mvc
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Asp . Versioning ;
4
4
5
+ using Asp . Versioning . ApplicationModels ;
5
6
using Asp . Versioning . Conventions ;
6
7
using Microsoft . AspNetCore . Mvc . Abstractions ;
8
+ using Microsoft . AspNetCore . Mvc . ApplicationModels ;
7
9
using Microsoft . AspNetCore . Mvc . Controllers ;
8
10
using System . Runtime . CompilerServices ;
9
11
using static Asp . Versioning . ApiVersionMapping ;
@@ -102,13 +104,22 @@ protected virtual string GetControllerName( ActionDescriptor action )
102
104
return NamingConvention . GroupName ( name ) ;
103
105
}
104
106
107
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
108
+ private static bool IsUnversioned ( ActionDescriptor action ) => action . GetApiVersionMetadata ( ) == ApiVersionMetadata . Empty ;
109
+
105
110
private IEnumerable < IReadOnlyList < ActionDescriptor > > GroupActionsByController ( IList < ActionDescriptor > actions )
106
111
{
107
112
var groups = new Dictionary < string , List < ActionDescriptor > > ( StringComparer . OrdinalIgnoreCase ) ;
108
113
109
114
for ( var i = 0 ; i < actions . Count ; i ++ )
110
115
{
111
116
var action = actions [ i ] ;
117
+
118
+ if ( IsUnversioned ( action ) )
119
+ {
120
+ continue ;
121
+ }
122
+
112
123
var key = GetControllerName ( action ) ;
113
124
114
125
if ( string . IsNullOrEmpty ( key ) )
You can’t perform that action at this time.
0 commit comments