Skip to content

Commit

Permalink
Dev/xavier/fix controller name attr (#1039)
Browse files Browse the repository at this point in the history
* Suppress CA1825

* controller.RouteValues.TryGetValue

* Update version and release notes.

* VersionPrefix

* Update release note.

* Setup .net for code ql

* Setup .NET 3.1

* Update Codeql

* Update code ql

* Touch.

* Setup .NET 6.0 SDK

* add global.json

* Add Setup .NET 3.1 SDK

* Setup dotnet

* Create temporary global.json

* revert gitignore.

* Remove bad merge.
  • Loading branch information
xavierjohn authored Nov 22, 2023
1 parent bc9320a commit db40318
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) )
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>6.4.0</VersionPrefix>
<VersionPrefix>6.4.1</VersionPrefix>
<AssemblyVersion>6.4.0.0</AssemblyVersion>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<RootNamespace>Asp.Versioning</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@

If Controller Attribute is set, use it for the controller name ([#1033](https://github.com/dotnet/aspnet-api-versioning/issues/1033))

0 comments on commit db40318

Please sign in to comment.