Skip to content

Make HttpMethodActionConstraint public in Core 3.0 #8653

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

Closed
EvilBeaver opened this issue Mar 19, 2019 · 7 comments
Closed

Make HttpMethodActionConstraint public in Core 3.0 #8653

EvilBeaver opened this issue Mar 19, 2019 · 7 comments
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Done This issue has been fixed task

Comments

@EvilBeaver
Copy link

Is your feature request related to a problem? Please describe.

I'm making my own ApplicationModelProvider. Before Core 3.0 I used an HttpMethodActionConstraint in my ActionModels to filter out actions by http method.

In Core 3.0 HttpMethodActionConstraint was made an internal class. Why?

Example: 'm trying to do

var selectorModel = new SelectorModel();
selectorModel.ActionConstraints.Add(new HttpMethodActionConstraint(httpMethods));

Describe the solution you'd like

I want to use an existing reusable class HttpMethodActionConstraint from Microsoft.AspNetCore.Mvc.ActionConstraints instead of making my own.

Describe alternatives you've considered

alternative solution. Copy/Paste source of Microsoft.AspNetCore.Mvc.ActionConstraints.HttpMethodActionConstraint in my project

Additional context

Custom ApplicationModelProvider is used for integration with database-provided model. I don't need an AspNetCore's class-based model, but want to use all other stuff. AppModels are great and limitation of their's building blocks is making me sad.

@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Mar 19, 2019
@pranavkm
Copy link
Contributor

The type was pubinternal in 2.x and we defaulted to making it internal as part of #4932. If your app uses endpoint-routing, you may use HttpMethodMetadata instead. It's what MVC does under the hood - https://github.com/aspnet/AspNetCore/blob/c565386a3ed135560bc2e9017aa54a950b4e35dd/src/Mvc/Mvc.Core/src/Routing/ActionEndpointFactory.cs#L249-L253.

If you are unable to use endpoint routing, we'd be happy to consider a PR to make the type public.

@mkArtakMSFT mkArtakMSFT added 1 - Ready enhancement This issue represents an ask for new feature or an enhancement to an existing one question and removed 1 - Ready enhancement This issue represents an ask for new feature or an enhancement to an existing one labels Mar 19, 2019
@mkArtakMSFT
Copy link
Contributor

Thanks for contacting us. We believe that the question you've raised have been answered. If you still feel a need to continue the discussion, feel free to reopen it and add your comments.

@EvilBeaver
Copy link
Author

Yes, thank you for the answer.

@ismcagdas
Copy link

Hi @pranavkm sorry for writing to a closed issue but we have a similar problem. We are using HttpMethodActionConstraint in two places of our custom IApplicationModelConvention implementation to prevent usage of http verbs for some auto generated controllers, see below lines:

https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Mvc/Conventions/AbpAppServiceConvention.cs#L122
https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Mvc/Conventions/AbpAppServiceConvention.cs#L229

I tried to change this but couldn't succeed without using HttpMethodActionConstraint. Do you think it is possible to achieve this without using HttpMethodActionConstraint ?

@rynowak rynowak reopened this Jul 5, 2019
@rynowak rynowak added task and removed question labels Jul 5, 2019
@rynowak rynowak self-assigned this Jul 5, 2019
@rynowak rynowak added this to the 3.0.0-preview8 milestone Jul 5, 2019
@rynowak
Copy link
Member

rynowak commented Jul 5, 2019

We've heard enough feedback about this particular issue that we're going to make this public.

@rynowak
Copy link
Member

rynowak commented Jul 5, 2019

Along with AmbiguousActionException

@rynowak rynowak added the Done This issue has been fixed label Jul 9, 2019
@rynowak
Copy link
Member

rynowak commented Jul 9, 2019

Fixed by: #11969

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Done This issue has been fixed task
Projects
None yet
Development

No branches or pull requests

6 participants