Fix GraphQL Implementation and also UI Playground and add supports for Oracle Provider using EF Core ...

This commit is contained in:
2026-05-13 23:14:37 +03:30
parent 3bb6042b31
commit 99dc78ee4b
11 changed files with 576 additions and 296 deletions
+42 -10
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using GraphQL.Server.Ui.Playground;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Configuration;
@@ -45,10 +46,24 @@ namespace xDataService.DI
.ForEach(db =>
{
//
// TODO: Fix this ...
var sectionName = $"{ConfigurationNodeNames.DATA_SERVICE_NODE}:{nameof(XDataServiceConfiguration.Databases)}:{db.Key}:{nameof(XDataBaseConfiguration.SeedItems)}";
// var seedItems = source.GetSectionAsDictionary(sectionName);
// db.Value.SeedItems = seedItems;
var seedItemsSectionName = $"{ConfigurationNodeNames.DATA_SERVICE_NODE}:{nameof(XDataServiceConfiguration.Databases)}:{db.Key}:{nameof(XDataBaseConfiguration.SeedItems)}";
var section = source.GetSection(seedItemsSectionName);
var sectionJson = source.GetSectionAsJson(seedItemsSectionName);
var sectionDict = sectionJson.FromJSON<Dictionary<string, List<object>>>();
if (!sectionDict.IsNull() &&
sectionDict.Values.HasChild())
{
//
sectionDict
.Keys
.ToList()
.ForEach(entity =>
{
//
// Setting Values to Result ...
result.Databases[db.Key].SeedItems[entity] = sectionDict[entity];
});
}
});
}
@@ -248,7 +263,8 @@ namespace xDataService.DI
public static void UseXDatabase(
this IApplicationBuilder source,
XDatabaseDescriptor descriptor,
bool isDevelopmentEnvironment = false
bool isDevelopmentEnvironment = false,
GraphQLPlaygroundOptions options = null
)
{
//
@@ -265,9 +281,9 @@ namespace xDataService.DI
//
var withPlayground = false;
var isGraphConfigured = false;
if (isDevelopmentEnvironment)
{
//
withPlayground = true;
}
@@ -297,6 +313,7 @@ namespace xDataService.DI
//
// Check Seeder Exists ...
// Execute Seeding Data Task if Exists ...
isValid = r.HasSeeder();
if (isValid)
{
@@ -312,7 +329,8 @@ namespace xDataService.DI
// Seeding ...
seeder
.Seed()
.RunTask();
.GetAwaiter()
.GetResult();
}
}
@@ -323,7 +341,10 @@ namespace xDataService.DI
{
//
// Use WebSockets ...
source.UseWebSockets();
if (!isGraphConfigured)
{
source.UseWebSockets();
}
//
// Inject GraphQL Type Helper ...
@@ -332,7 +353,9 @@ namespace xDataService.DI
if (isValid)
{
//
string graphPath = helper.GetGraphQLPath();
string graphPath = $"{helper.GetGraphQLPath()}";
// string graphPath = $"{dataServiceConfiguration.GraphQLBasePath}{helper.GetGraphQLPath()}";
graphPath = $"{helper.GetGraphQLPath()}";
typeof(XDataServiceHelper).InvokeGenericMethod(
methodName: "UseXGraphQL",
runtimeTypes: [
@@ -352,6 +375,15 @@ namespace xDataService.DI
null
]
);
//
Log($"Register GraphQL: {graphPath}");
}
//
if (!isGraphConfigured)
{
isGraphConfigured = true;
}
}
});