How do I handle versioning in my ASP.NET Web-Api project? I need to have certain functionality version specific:
example:
/v1/people
/v2/people/friends
How do I implement this in Web-API? Do I use different controllers or actions?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Simply said: You need to create a custom IHttpControllerSelector and register it via HttpConfiguration.Services. An IHttpControllerSelector has the responsibility for selecting a controller based on the request.
There is actually a library you can use for it:
https://github.com/Sebazzz/SDammann.WebApi.Versioning
http://damsteen.nl/blog/implementing-versioning-in-asp.net-web-api