These folks seem to think [controller] works in [ODataRoutePrefix("todo")] public TodoController : ODataController
- https://stackoverflow.com/questions/51809295/net-core-2-1-odatarout-not-working
- dotnet/aspnet-api-versioning#209
This seems to work:
[ODataRoutePrefix("todo")] public TodoController : ODataController- more complete sample see https://stackoverflow.com/a/63852770/195755
This DOES NOT work, as far as I know:
[ODataRoutePrefix("[controller]")] public TodoController : ODataController- vs
[Route("[controller]")][ApiController] public TodoController- generated REST API
- CRUD API from scaffolding
But the latter would be a MAJOR UPGRADE to allow conventions to be used in routes.
Based on:
- all the same benefits of convention-based routing, which ASP.NET Core team has convinced this community is a big win
- it is VERY common the controller is named for entity set, just like REST APIs
- web API generators emit
[controller], makes it easier to change from[Route("[controller])"]to[ODataPrefix("[controller]")] - I can't get OData default convention-based routing to work in ASPNET Core. If convention-based routing for
~/api/todo(10)or~/odata/todo(10)worked then this would not be nesssary.
The above PR addresses ActionSelector, which affects all routes, not just convention-based routes. Not sure if it affects batching, but I assume it does.