Add Required Stuffs to running Project on net8.0 ...
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
using GraphQL.Server;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using xAiApi.Data.GraphQL;
|
||||
using xAiApi.Data.Interfaces;
|
||||
using xAiApi.Data.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.GraphQL;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiApi.Data.Helpers
|
||||
{
|
||||
public class XAiApiDataHelperGraphQLHelper : IXGraphQLHelper
|
||||
{
|
||||
public void AddXGraphEnumTypes(IServiceCollection services) { }
|
||||
|
||||
public void AddXGraphInputTypes(IServiceCollection services) { }
|
||||
|
||||
public void AddXGraphMutations(IServiceCollection services) { }
|
||||
|
||||
public void AddXGraphObjectTypes(IServiceCollection services)
|
||||
{
|
||||
//
|
||||
// XTest ...
|
||||
services.AddSingleton<XTestGraphType>();
|
||||
services.AddSingleton<XBaseGraphQLEventType<XTest, int, XTestGraphType>>();
|
||||
}
|
||||
|
||||
public void AddXGraphQueries(IServiceCollection services)
|
||||
{
|
||||
//
|
||||
// XTest ...
|
||||
services.AddSingleton<IXTestGraphQLTypeHelper, XTestGraphQLTypeHelper>();
|
||||
services.AddScoped<XTestGraphQuery>();
|
||||
}
|
||||
|
||||
public void AddXGraphSchemas(IServiceCollection services)
|
||||
{
|
||||
//
|
||||
services.AddScoped<XTestGraphSchema>();
|
||||
}
|
||||
|
||||
public void AddXGraphSubscriptions(IServiceCollection services) { }
|
||||
|
||||
public IGraphQLBuilder AddXGraphTypes(IGraphQLBuilder builder)
|
||||
{
|
||||
//
|
||||
builder.AddGraphTypes(typeof(XTestGraphSchema));
|
||||
|
||||
//
|
||||
return builder;
|
||||
}
|
||||
|
||||
public void UseXGraph(IApplicationBuilder app)
|
||||
{
|
||||
//
|
||||
using (var scope = app.ApplicationServices.CreateScope())
|
||||
{
|
||||
//
|
||||
// XDataServiceConfiguration ...
|
||||
var dataServiceConfiguration = scope.ServiceProvider.GetService<XDataServiceConfiguration>();
|
||||
|
||||
//
|
||||
// XTest ...
|
||||
var testHelper = scope.ServiceProvider.GetService<IXTestGraphQLTypeHelper>();
|
||||
app.UseGraphQL<XTestGraphSchema>(testHelper.GetGraphQLPath());
|
||||
app.UseGraphQLWebSockets<XTestGraphSchema>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user