Inicio.AspNetCore.Versioning
5.0.0
dotnet add package Inicio.AspNetCore.Versioning --version 5.0.0
NuGet\Install-Package Inicio.AspNetCore.Versioning -Version 5.0.0
<PackageReference Include="Inicio.AspNetCore.Versioning" Version="5.0.0" />
paket add Inicio.AspNetCore.Versioning --version 5.0.0
#r "nuget: Inicio.AspNetCore.Versioning, 5.0.0"
// Install Inicio.AspNetCore.Versioning as a Cake Addin
#addin nuget:?package=Inicio.AspNetCore.Versioning&version=5.0.0
// Install Inicio.AspNetCore.Versioning as a Cake Tool
#tool nuget:?package=Inicio.AspNetCore.Versioning&version=5.0.0
Example
In the following example, requests specifying API version 1 or 2 will return the original action method, Get
. Requests for version 3 and above will return the modified implementation, Get_V3
.
Note that there is no need to create an action method implementaion for every API version.
[HttpGet]
public ActionResult Get()
{
return Ok();
}
[HttpGet, Version(3)]
public ActionResult Get_V3()
{
return Ok();
}
Getting Started
Reference
Inicio.AspNetCore.Versioning
.Add a Version parameter to all API routes.
Note: the version parameter must be named {version}.
[Route("api/v{version}/[controller]")]
Optionally, a route constraint may be used:
[Route("api/v{version:int}/[controller]")]
Add Version attributes to actions requiring versioning.
using Inicio.AspNetCore.Versioning; [HttpGet, Version(2)] public ActionResult Get_V2() { return Ok(); }
Optionally, both lower and upper version bounds can be specified:
[Version(2, 3)]
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- No dependencies.
-
net5.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Inicio.AspNetCore.Versioning:
Package | Downloads |
---|---|
Inicio.AspNetCore.Versioning.Swagger
Adds Swagger support to Inicio.AspNetCore.Versioning. |
GitHub repositories
This package is not used by any popular GitHub repositories.