last ...
This commit is contained in:
+20
-41
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using IdentityModel.AspNetCore.OAuth2Introspection;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -15,10 +15,11 @@ using Newtonsoft.Json.Serialization;
|
||||
using xApi.Extensions;
|
||||
using xCommons.Configurations;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.DI;
|
||||
using xDataService.Models;
|
||||
using xHttpService.DI;
|
||||
using xIdentityService.DI;
|
||||
using xServices.Databases;
|
||||
using xServices.DI;
|
||||
|
||||
namespace xApi
|
||||
{
|
||||
@@ -32,6 +33,9 @@ namespace xApi
|
||||
{
|
||||
//
|
||||
Configuration = configuration;
|
||||
|
||||
//
|
||||
// Create an Api Descriptor Class Instance ...
|
||||
apiDatabaseDescriptor = new XApiDatabaseDescriptor();
|
||||
}
|
||||
|
||||
@@ -61,24 +65,8 @@ namespace xApi
|
||||
services.AddXHttpService(Configuration);
|
||||
|
||||
//
|
||||
// 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;
|
||||
});
|
||||
|
||||
//
|
||||
var lifeTime = ServiceLifetime.Scoped;
|
||||
// Add Api V1 Versioning ...
|
||||
services.AddXApiV1Versioning();
|
||||
|
||||
//
|
||||
// OAuthIntrospectin Http Client Handler ...
|
||||
@@ -120,26 +108,22 @@ namespace xApi
|
||||
});
|
||||
|
||||
//
|
||||
// Check Data Service ...
|
||||
var dataServiceConfig = Configuration.GetXDataServiceConfiguration();
|
||||
|
||||
//
|
||||
// Check DataBase Registration ...
|
||||
services.AddXDatabase(
|
||||
lifetime: lifeTime,
|
||||
// Register Services ...
|
||||
services.AddXServices(
|
||||
configuration: Configuration,
|
||||
descriptor: apiDatabaseDescriptor
|
||||
databases: new List<XDatabaseDescriptor>
|
||||
{
|
||||
apiDatabaseDescriptor
|
||||
},
|
||||
lifeTime: ServiceLifetime.Scoped
|
||||
);
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
//
|
||||
var withPlayground = false;
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
//
|
||||
withPlayground = true;
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
@@ -181,18 +165,13 @@ namespace xApi
|
||||
|
||||
//
|
||||
// Use xDataService Middleware ...
|
||||
app.UseXDatabase(
|
||||
descriptor: apiDatabaseDescriptor,
|
||||
app.UseXServices(
|
||||
databases: new List<XDatabaseDescriptor>
|
||||
{
|
||||
apiDatabaseDescriptor
|
||||
},
|
||||
isDevelopmentEnvironment: env.IsDevelopment()
|
||||
);
|
||||
|
||||
//
|
||||
// Using Services ...
|
||||
// app.UseXServices();
|
||||
|
||||
//
|
||||
// Use xGraphQL Middleware ...
|
||||
// app.UseXGraphQL(withPlayground: withPlayground);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user