Last works ...
This commit is contained in:
+26
-3
@@ -3,6 +3,7 @@ using xApi.Attributes;
|
||||
using System.Reflection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
//
|
||||
// Access Application Builder ...
|
||||
@@ -18,17 +19,39 @@ var xmlFilePath = Path.Combine(AppContext.BaseDirectory, xmlFilename);
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
|
||||
//
|
||||
// Register Swagger Generator ...
|
||||
// Extract Api Configuration ...
|
||||
var appConfiguration = builder.Configuration
|
||||
.GetApiConfiguration() ??
|
||||
.GetApiConfiguration() ??
|
||||
throw new InvalidDataException("Api Configuration is not Found ...");
|
||||
if (!appConfiguration.IsValid())
|
||||
{
|
||||
throw new InvalidDataException("Api Configuration is not Valid ...");
|
||||
}
|
||||
builder.Services.AddApiConfiguration(appConfiguration);
|
||||
|
||||
//
|
||||
builder.Services.AddSingleton(appConfiguration);
|
||||
// Register Azure Service ...
|
||||
builder.Services.AddAzureApiServices(builder.Configuration);
|
||||
|
||||
//
|
||||
// Register Api Versioning ...
|
||||
builder.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;
|
||||
});
|
||||
|
||||
//
|
||||
// Register Swagger Generator ...
|
||||
builder.Services.AddSwaggerGen(delegate (SwaggerGenOptions options)
|
||||
{
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user