Click here to Skip to main content
15,898,036 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am doing some R&D on MVC Web API versioning. I have also implemented two type of versioning
1- URL Versioning i.e Passing the version number in Http header.
2- Namespace Versioning i.e creating folders v1,v2 etc.
But what in both methods i need to have another copy of the controller.
For example i have Controller by name CustomerController in version1 which has Get method only, now for version2 i need to copy this method Get so i will be having controller for Customer now. Cant i handle this within one controller instead of having two controllers.
Posted
Comments
girishmeena 6-Apr-18 1:48am    
Could you explain more why you need multiple Controller?
I hope you have already using MVC routing to redirect to particular controller Action based on URI.

Further, URL versioning is to have version number within the URL.

E.g. Suppose you are using EmployeeController for employee APIs.

1st Version
web/v1/api/GetEmployee
GetEmployee

2nd Version in the same controller
web/api/v2/GetEmployee

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900