I am working in dotnet core api. I have to implement versioning on api. and swagger document should be categorized by api version.
解决方案
In .NetCore api versioning can be implement by adding below reference from nuget
Microsoft.AspNetCore.Mvc.Versioning
Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer
After adding reference do following in startup file of your project. Add below line before AddMvc line. I will use Header-api versioning. It means client will mention the version in header. Header name is customizable.
services.AddApiVersioning(this.Configuration);
Definition of AddApiVersioning would be like as (In different extension class):
public static void AddApiVersioning(this IServiceCollection services, IConfiguration configuration)
{
services.AddApiVersioning(apiVersioningOptions =>
{