Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If Controller Attribute is set, use it for the controller's name #1043

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ jobs:

- name: Setup .NET
uses: actions/setup-dotnet@v3
id: installdotnet
with:
dotnet-version: 7.0.x

- name: Create temporary global.json
run: echo '{"sdk":{"version":"${{ steps.installdotnet.outputs.dotnet-version }}"}}' > ./global.json

# build a temporary *.slnf file that only contains source projects and put it in ~/obj
# so that it is not tracked by git. then run 'dotnet build' using the *.slnf, which
# will preserve the dependency order and configuration of the *.sln
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ public virtual void OnProvidersExecuting( ApplicationModelProviderContext contex
{
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>7.1.0</VersionPrefix>
<VersionPrefix>7.1.1</VersionPrefix>
<AssemblyVersion>7.1.0.0</AssemblyVersion>
<TargetFramework>net7.0</TargetFramework>
<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))
Loading