Open jez9999 opened 2 years ago
I am trying to use non-attribute routing for my ApiController
What is your motivation for using non-attribute routing for your controller? Have you considered using something other than ApiController
? ApiController
s currently rely on attribute routing by design.
Hi @jez9999. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
@captainsafia I can use attribute routing. I'm just interested as to why that design restriction is there when someone might prefer to use convention-based routing.
Triage: We should investigate whether we can support non-attribute routing for ApiController's now without breaking back-compat.
@captainsafia Use case for this request can be : Defining a route prefix at a single place so it is applied to all controllers. Right now, we have to change the attribute on every Controller. If an alternative to that problem exists , please suggest.
Problem Reference Link: https://stackoverflow.com/questions/73387620/how-to-add-api-prefix-to-every-end-point-in-an-asp-net-core-web-api
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I am trying to use non-attribute routing for my
ApiController
but when I try toUseEndpoints()
throws the exception:Describe the solution you'd like
ApiController
s should support non-attribute routing.Additional context
It's regularly stated that attribute routing becomes a requirement when a controller is an
ApiController
. What I don't understand is why. It seems completely arbitrary. Can't it be opened up to non-attribute routing, or does this cause some technical problem?