webapi versioning the easy way

Turn out that doing webapi service versioning is relatively easy in Asp.net core. First off, please install the following nuget package :-

Install-Package Microsoft.AspNetCore.Mvc.Versioning -Version 2.0.0

Next up, is to organize your controllers into folders. I prefer to use folder (namespace) as a way to do it, so i can have the same controller name versioned differently, as shown below :-

--->V1-->Controller-->HelloController(version 1)

-->V2 -->Controller-->HelloController (version 2)

Next we just need to decorate our HelloController with the proper attribute.

Version 1 Controller.

Version 2 Controller


Popular posts from this blog

ionic2 cordova build android - Unable resolve gradle 2.2.3

A quick tutorial for OWASP ZAP tool for beginners