Compare commits

..
10 Commits
Author SHA1 Message Date
saherelm 97a6fa92ed last ... 2026-07-29 00:15:41 +03:30
saherelm 8d256786c4 last ... 2026-07-28 14:27:47 +03:30
saherelm 937d9e9df6 last ... 2026-07-26 21:19:57 +03:30
saherelm a62f404bc9 last ... 2026-06-20 21:52:25 +03:30
saherelm e67d07f703 last ... 2026-06-12 23:44:49 +03:30
saherelm 3ff20403f9 Update Lang Version to 12 ...
Add Support for Get All as Async Enumerable ...
2026-06-12 02:13:10 +03:30
saherelm b4d8484f4c apply fix on GraphQL ... 2026-06-01 15:49:03 +03:30
saherelm 3adc60599c last ... 2026-06-01 01:25:19 +03:30
saherelm 17be3422a3 last ... 2026-05-31 07:36:07 +03:30
saherelm 7aa60b5e6e last ... 2026-05-28 02:30:32 +03:30
12 changed files with 142 additions and 40 deletions
@@ -17,7 +17,6 @@ namespace xDataService.Configuration
/// <summary> /// <summary>
/// Data Bases Configuration ... /// Data Bases Configuration ...
/// </summary> /// </summary>
/// <typeparam name="XDataBaseConfiguration"></typeparam>
/// <returns></returns> /// <returns></returns>
public IDictionary<string, XDataBaseConfiguration> Databases { get; set; } = new Dictionary<string, XDataBaseConfiguration>(); public IDictionary<string, XDataBaseConfiguration> Databases { get; set; } = new Dictionary<string, XDataBaseConfiguration>();
+4 -5
View File
@@ -23,7 +23,6 @@ namespace xDataService.DI
/// Retrive XDataService Configurations /// Retrive XDataService Configurations
/// </summary> /// </summary>
/// <param name="source"></param> /// <param name="source"></param>
/// <param name="connectionName"></param>
/// <returns></returns> /// <returns></returns>
public static XDataServiceConfiguration GetXDataServiceConfiguration( public static XDataServiceConfiguration GetXDataServiceConfiguration(
this IConfiguration source this IConfiguration source
@@ -193,7 +192,7 @@ namespace xDataService.DI
// //
// Register Handler Service ... // Register Handler Service ...
source.AddSingleton<XEntityRegisterarHandlerService>(); source.AddSingleton<XEntityRegisterarHandlerService>();
// //
// Configure Database Descriptor ... // Configure Database Descriptor ...
descriptor.Configure(source); descriptor.Configure(source);
@@ -402,9 +401,9 @@ namespace xDataService.DI
], ],
args: [ args: [
source, source,
graphBasePath, graphBasePath,
graphPath, graphPath,
withPlayground withPlayground
] ]
); );
-8
View File
@@ -111,14 +111,6 @@ namespace xDataService.Db
// Automatically apply all IEntityTypeConfiguration<T> in this assembly // Automatically apply all IEntityTypeConfiguration<T> in this assembly
modelBuilder.ApplyConfigurationsFromAssembly(typeof(XDbContext).Assembly); modelBuilder.ApplyConfigurationsFromAssembly(typeof(XDbContext).Assembly);
//
// Extract Entity Container Assemblies ...
var entityAssemblies = XDataServiceHelper.ExtractEntityAssemblies();
foreach(var assembly in entityAssemblies)
{
modelBuilder.ApplyConfigurationsFromAssembly(assembly);
}
// //
// Check Dynamic Registered Service is Exists or not ... // Check Dynamic Registered Service is Exists or not ...
if (!dynamicEntityHandlers.IsNull()) if (!dynamicEntityHandlers.IsNull())
+1 -1
View File
@@ -12,7 +12,7 @@ namespace xDataService.GraphQL
private readonly XDataServiceConfiguration configuration; private readonly XDataServiceConfiguration configuration;
// //
public XBaseGraphQLTypeHelper( protected XBaseGraphQLTypeHelper(
XDataServiceConfiguration configuration = null XDataServiceConfiguration configuration = null
) )
{ {
+26 -7
View File
@@ -1281,6 +1281,22 @@ namespace xDataService.Helpers
// //
return result; return result;
} }
/// <summary>
/// Register All Entities using Model Builder ...
/// </summary>
/// <param name="modelBuilder"></param>
public static void RegisterAllEntities(this ModelBuilder modelBuilder)
{
//
// Extract Entity Container Assemblies ...
var entityAssemblies = ExtractEntityAssemblies();
foreach(var assembly in entityAssemblies)
{
modelBuilder.ApplyConfigurationsFromAssembly(assembly);
}
}
#endregion #endregion
// //
@@ -1460,7 +1476,7 @@ namespace xDataService.Helpers
// Register Graph Type ... // Register Graph Type ...
source.Add( source.Add(
new ServiceDescriptor( new ServiceDescriptor(
lifetime: ServiceLifetime.Singleton, lifetime: lifetime, // ServiceLifetime.Singleton,
serviceType: repositoryDescriptor.GraphType, serviceType: repositoryDescriptor.GraphType,
implementationType: repositoryDescriptor.GraphType implementationType: repositoryDescriptor.GraphType
) )
@@ -1470,7 +1486,7 @@ namespace xDataService.Helpers
// Register Graph Events ... // Register Graph Events ...
source.Add( source.Add(
new ServiceDescriptor( new ServiceDescriptor(
lifetime: ServiceLifetime.Singleton, lifetime: lifetime, // ServiceLifetime.Singleton,
serviceType: typeof(XBaseGraphQLEventType<TEntity, TKey, TGraph>), serviceType: typeof(XBaseGraphQLEventType<TEntity, TKey, TGraph>),
implementationType: typeof(XBaseGraphQLEventType<TEntity, TKey, TGraph>) implementationType: typeof(XBaseGraphQLEventType<TEntity, TKey, TGraph>)
) )
@@ -1500,14 +1516,14 @@ namespace xDataService.Helpers
// Register Graph Schema ... // Register Graph Schema ...
source.Add( source.Add(
new ServiceDescriptor( new ServiceDescriptor(
lifetime: lifetime,
serviceType: repositoryDescriptor.GraphSchema, serviceType: repositoryDescriptor.GraphSchema,
implementationType: repositoryDescriptor.GraphSchema, implementationType: repositoryDescriptor.GraphSchema
lifetime: lifetime
) )
); );
// //
source.AddSingleton<IDocumentExecuter, DocumentExecuter>(); source.AddScoped<IDocumentExecuter, DocumentExecuter>();
// //
// Register Graph Type Schema ... // Register Graph Type Schema ...
@@ -1528,9 +1544,12 @@ namespace xDataService.Helpers
.AddNewtonsoftJson(deserializerSettings => { }, serializerSettings => { }) .AddNewtonsoftJson(deserializerSettings => { }, serializerSettings => { })
.AddWebSockets() .AddWebSockets()
.AddDataLoader() .AddDataLoader()
.AddGraphTypes(); .AddGraphTypes(lifetime);
} }
builder.AddGraphTypes(repositoryDescriptor.GraphSchema); builder.AddGraphTypes(
serviceLifetime: lifetime,
typeFromAssembly: repositoryDescriptor.GraphSchema
);
} }
#endregion #endregion
} }
+41 -15
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using xDataService.Models; using xDataService.Models;
using xModels.Dtos; using xModels.Dtos;
@@ -30,41 +31,58 @@ namespace xDataService.Interfaces
/// </summary> /// </summary>
/// <param name="providedForId"></param> /// <param name="providedForId"></param>
/// <param name="forIndex"></param> /// <param name="forIndex"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<TModel> GetReference( Task<TModel> GetReference(
TKey providedForId, TKey providedForId,
int forIndex = 0 int forIndex = 0,
CancellationToken cancellationToken = default
); );
/// <summary> /// <summary>
/// Retrieve all Exists References of Specific Provided ID ... /// Retrieve all Exists References of Specific Provided ID ...
/// </summary> /// </summary>
/// <param name="providedForId"></param> /// <param name="providedForId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<IEnumerable<TModel>> GetAllReferences(TKey providedForId); Task<IEnumerable<TModel>> GetAllReferences(
TKey providedForId,
CancellationToken cancellationToken = default
);
/// <summary> /// <summary>
/// Extract all Referencing Models for Specified Key ... /// Extract all Referencing Models for Specified Key ...
/// </summary> /// </summary>
/// <param name="providedForId"></param> /// <param name="providedForId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<IEnumerable<XReference<TKey>>> GetAllReferencings(TKey providedForId); Task<IEnumerable<XReference<TKey>>> GetAllReferencings(
TKey providedForId,
CancellationToken cancellationToken = default
);
/// <summary> /// <summary>
/// Count References ... /// Count References ...
/// </summary> /// </summary>
/// <param name="providedForId"></param> /// <param name="providedForId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<int> CountReferences(TKey providedForId); Task<int> CountReferences(
TKey providedForId,
CancellationToken cancellationToken = default
);
/// <summary> /// <summary>
/// Retrieve References of Specific Provided ID as Query ... /// Retrieve References of Specific Provided ID as Query ...
/// </summary> /// </summary>
/// <param name="query"></param>
/// <param name="providedForId"></param> /// <param name="providedForId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<XQueryResult<TModel>> QueryReferences( Task<XQueryResult<TModel>> QueryReferences(
XQuery query, XQuery query,
TKey providedForId TKey providedForId,
CancellationToken cancellationToken = default
); );
/// <summary> /// <summary>
@@ -72,26 +90,29 @@ namespace xDataService.Interfaces
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
/// <param name="providedForId"></param> /// <param name="providedForId"></param>
/// <param name="forIndex"></param>
/// <param name="connectionId"></param> /// <param name="connectionId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> AddReference( Task<bool> AddReference(
TModel model, TModel model,
TKey providedForId, TKey providedForId,
string connectionId = null string connectionId = null,
CancellationToken cancellationToken = default
); );
/// <summary> /// <summary>
/// Add Reference a Model to Specific XRefence<TKey> ... /// Add Reference a Model to Specific XRefence<TKey/> ...
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
/// <param name="reference"></param> /// <param name="reference"></param>
/// <param name="connectionId"></param> /// <param name="connectionId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> AddReference( Task<bool> AddReference(
TModel model, TModel model,
XReference<TKey> reference, XReference<TKey> reference,
string connectionId = null string connectionId = null,
CancellationToken cancellationToken = default
); );
/// <summary> /// <summary>
@@ -99,26 +120,29 @@ namespace xDataService.Interfaces
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
/// <param name="providedForId"></param> /// <param name="providedForId"></param>
/// <param name="forIndex">if null, removes all</param>
/// <param name="connectionId"></param> /// <param name="connectionId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> RemoveReference( Task<bool> RemoveReference(
TModel model, TModel model,
TKey providedForId, TKey providedForId,
string connectionId = null string connectionId = null,
CancellationToken cancellationToken = default
); );
/// <summary> /// <summary>
/// Remove Reference a Model for Specific XRefence<TKey> ... /// Remove Reference a Model for Specific XRefence<TKey/> ...
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
/// <param name="providedForId"></param> /// <param name="reference"></param>
/// <param name="connectionId"></param> /// <param name="connectionId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> RemoveReference( Task<bool> RemoveReference(
TModel model, TModel model,
XReference<TKey> reference, XReference<TKey> reference,
string connectionId = null string connectionId = null,
CancellationToken cancellationToken = default
); );
/// <summary> /// <summary>
@@ -126,10 +150,12 @@ namespace xDataService.Interfaces
/// </summary> /// </summary>
/// <param name="providedForId"></param> /// <param name="providedForId"></param>
/// <param name="connectionId"></param> /// <param name="connectionId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> RemoveReferences( Task<bool> RemoveReferences(
TKey providedForId, TKey providedForId,
string connectionId = null string connectionId = null,
CancellationToken cancellationToken = default
); );
#endregion #endregion
} }
+1
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.Query;
+17
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoMapper; using AutoMapper;
@@ -227,6 +228,22 @@ namespace xDataService.Interfaces
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
); );
/// <summary>
/// retrieve all exists Dtos
/// as Async Enumerable ...
/// </summary>
/// <param name="ignoreSoftDeleteds"></param>
/// <param name="orderBuilder"></param>
/// <param name="includeBuilder"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
IAsyncEnumerable<TDto> GetAllAsAsyncEnumerable(
bool ignoreSoftDeleteds = true,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
CancellationToken cancellationToken = default
);
/// <summary> /// <summary>
/// find an Dto by providing a Conditional Expression ... /// find an Dto by providing a Conditional Expression ...
/// </summary> /// </summary>
+1
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
+37
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoMapper; using AutoMapper;
@@ -613,6 +614,42 @@ namespace xDataService.Providers
return result; return result;
} }
/// <summary>
/// retrieve all exists Dtos
/// as Async Enumerable ...
/// </summary>
/// <param name="ignoreSoftDeleteds"></param>
/// <param name="orderBuilder"></param>
/// <param name="includeBuilder"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async IAsyncEnumerable<TDto> GetAllAsAsyncEnumerable(
bool ignoreSoftDeleteds = true,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBuilder = null,
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>> includeBuilder = null,
[EnumeratorCancellation] CancellationToken cancellationToken = default
)
{
//
var entityEnumerable = Repository.GetAllAsAsyncEnumerable(
orderBuilder: orderBuilder,
includeBuilder: includeBuilder,
ignoreSoftDeleteds: ignoreSoftDeleteds
);
await foreach (var entity in entityEnumerable)
{
//
if (cancellationToken.IsCancellationRequested)
{
yield break;
}
//
var dto = Mapper.Map<TDto>(entity);
yield return dto;
}
}
/// <summary> /// <summary>
/// find an Dto by providing a Conditional Expression ... /// find an Dto by providing a Conditional Expression ...
/// </summary> /// </summary>
+1 -1
View File
@@ -47,7 +47,6 @@ namespace xDataService.Providers
/// <summary> /// <summary>
/// Load all Dynamically Registered Entities ... /// Load all Dynamically Registered Entities ...
/// </summary> /// </summary>
/// <param name="path"></param>
public void HandleRegisteredEntities() public void HandleRegisteredEntities()
{ {
// //
@@ -95,6 +94,7 @@ namespace xDataService.Providers
/// Configure all Dynamically Registered Entities ... /// Configure all Dynamically Registered Entities ...
/// </summary> /// </summary>
/// <param name="modelBuilder"></param> /// <param name="modelBuilder"></param>
/// <param name="names"></param>
public void HandleApplyRegisteredEntitiesConfigurations( public void HandleApplyRegisteredEntitiesConfigurations(
ModelBuilder modelBuilder, ModelBuilder modelBuilder,
string[] names = null string[] names = null
+13 -2
View File
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<!-- Runtime Definitions --> <!-- Runtime Definitions -->
<PropertyGroup> <PropertyGroup>
<Version>1.0.0</Version> <Version>1.0.0</Version>
@@ -7,6 +8,7 @@
<Company>SaherElm IT Center</Company> <Company>SaherElm IT Center</Company>
<PackageId>xDashboard.xDataService</PackageId> <PackageId>xDashboard.xDataService</PackageId>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<Description> <Description>
provide base requiremennts for Repository DataBase using and tools for using in xDashboard provide base requiremennts for Repository DataBase using and tools for using in xDashboard
project. project.
@@ -18,7 +20,8 @@
<!-- Icon Handling --> <!-- Icon Handling -->
<ItemGroup> <ItemGroup>
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true" PackagePath="\icon.png" /> <None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true"
PackagePath="\icon.png" />
</ItemGroup> </ItemGroup>
<!-- Local Modules --> <!-- Local Modules -->
@@ -36,7 +39,7 @@
<PackageReference Include="MongoDB.Driver" Version="2.13.2" /> <PackageReference Include="MongoDB.Driver" Version="2.13.2" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" /> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
</ItemGroup> </ItemGroup>
<!-- GraphQL --> <!-- GraphQL -->
<ItemGroup> <ItemGroup>
<PackageReference Include="GraphQL" Version="3.0.0.2026" /> <PackageReference Include="GraphQL" Version="3.0.0.2026" />
@@ -65,4 +68,12 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.14" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.14" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.14" />
</ItemGroup> </ItemGroup>
<!-- For XML Documentation Support -->
<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
</Project> </Project>