Skip to content

How do you use versioning with OData attribute routing? #961

Discussion options

You must be logged in to vote

Honestly, this is probably a question better suited for the OData team, but I'll do my best to answer anyway. API Versioning doesn't change the way that attribute routing works in OData. The mapping is a bit strange to me and the documentation that shows E2E configuration is lacking IMHO. It certainly doesn't appear to work the way one might expect. If you find that it works normally, but then stops working when you apply API Versioning, then there might be an issue.

It took a lot of tinkering, but this configuration did finally work:

[ApiVersion( 1 )]
[ApiVersion( 2 )]
public class PeopleController : ODataController
{
    [HttpGet( "api/v{version:apiVersion}/people" )]
    [HttpGet( "api…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cjwainwright
Comment options

Answer selected by cjwainwright
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants