diff --git a/Extensions/DIExtensions.cs b/Extensions/DIExtensions.cs
index ab802b8..0a82265 100644
--- a/Extensions/DIExtensions.cs
+++ b/Extensions/DIExtensions.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
@@ -315,5 +316,29 @@ namespace xCommons.Extensions {
//
sources.UseCors (XPolicy.AllowedOrigins);
}
+
+ ///
+ /// Register Api V1 Versioning ...
+ ///
+ ///
+ 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;
+ });
+ }
}
}
\ No newline at end of file