diff --git a/.editorconfig b/.editorconfig index fe5a4a9e..8c17a132 100644 --- a/.editorconfig +++ b/.editorconfig @@ -180,4 +180,8 @@ dotnet_naming_style.test_methods.word_separator = _ dotnet_naming_rule.test_methods.style = test_methods dotnet_naming_rule.test_methods.symbols = test_methods -dotnet_naming_rule.test_methods.severity = error \ No newline at end of file +dotnet_naming_rule.test_methods.severity = error + +# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1825 +[*.{cs,vb}] +dotnet_diagnostic.CA1825.severity = none \ No newline at end of file diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs index ed1e996b..cda16298 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApiVersioningApplicationModelProvider.cs @@ -80,8 +80,14 @@ public virtual void OnProvidersExecuting( ApplicationModelProviderContext contex for ( var i = 0; i < controllers.Count; i++ ) { var controller = controllers[i]; - - controller.ControllerName = NamingConvention.NormalizeName( controller.ControllerName ); + if ( controller.RouteValues.TryGetValue( "controller", out var name ) ) + { + controller.ControllerName = name!; + } + else + { + controller.ControllerName = NamingConvention.NormalizeName( controller.ControllerName ); + } if ( !ConventionBuilder.ApplyTo( controller ) ) { diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj index 8ad4d30d..fc73900a 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/Asp.Versioning.Mvc.csproj @@ -1,7 +1,7 @@  - 6.4.0 + 6.4.1 6.4.0.0 net6.0;netcoreapp3.1 Asp.Versioning diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt index 5f282702..525fc7a3 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ReleaseNotes.txt @@ -1 +1 @@ - \ No newline at end of file +If Controller Attribute is set, use it for the controller name ([#1033](https://github.com/dotnet/aspnet-api-versioning/issues/1033)) \ No newline at end of file