last ...
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
@@ -315,5 +316,29 @@ namespace xCommons.Extensions {
|
|||||||
//
|
//
|
||||||
sources.UseCors (XPolicy.AllowedOrigins);
|
sources.UseCors (XPolicy.AllowedOrigins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register Api V1 Versioning ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services"></param>
|
||||||
|
public static void AddXApiV1Versioning(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Register Api Versioning ...
|
||||||
|
services.AddApiVersioning(opt =>
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Set Default Api Version ...
|
||||||
|
opt.DefaultApiVersion = new ApiVersion(1, 0);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set Routing to Default API Version, if Version unspecified ...
|
||||||
|
opt.AssumeDefaultVersionWhenUnspecified = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Report All Available Api Versions on Response ...
|
||||||
|
opt.ReportApiVersions = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user