Compare commits
10
Commits
f179e315c5
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97a6fa92ed | ||
|
|
8d256786c4 | ||
|
|
937d9e9df6 | ||
|
|
a62f404bc9 | ||
|
|
e67d07f703 | ||
|
|
3ff20403f9 | ||
|
|
b4d8484f4c | ||
|
|
3adc60599c | ||
|
|
17be3422a3 | ||
|
|
7aa60b5e6e |
@@ -17,7 +17,6 @@ namespace xDataService.Configuration
|
||||
/// <summary>
|
||||
/// Data Bases Configuration ...
|
||||
/// </summary>
|
||||
/// <typeparam name="XDataBaseConfiguration"></typeparam>
|
||||
/// <returns></returns>
|
||||
public IDictionary<string, XDataBaseConfiguration> Databases { get; set; } = new Dictionary<string, XDataBaseConfiguration>();
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace xDataService.DI
|
||||
/// Retrive XDataService Configurations
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="connectionName"></param>
|
||||
/// <returns></returns>
|
||||
public static XDataServiceConfiguration GetXDataServiceConfiguration(
|
||||
this IConfiguration source
|
||||
@@ -402,9 +401,9 @@ namespace xDataService.DI
|
||||
],
|
||||
args: [
|
||||
source,
|
||||
graphBasePath,
|
||||
graphPath,
|
||||
withPlayground
|
||||
graphBasePath,
|
||||
graphPath,
|
||||
withPlayground
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
@@ -111,14 +111,6 @@ namespace xDataService.Db
|
||||
// Automatically apply all IEntityTypeConfiguration<T> in this 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 ...
|
||||
if (!dynamicEntityHandlers.IsNull())
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace xDataService.GraphQL
|
||||
private readonly XDataServiceConfiguration configuration;
|
||||
|
||||
//
|
||||
public XBaseGraphQLTypeHelper(
|
||||
protected XBaseGraphQLTypeHelper(
|
||||
XDataServiceConfiguration configuration = null
|
||||
)
|
||||
{
|
||||
|
||||
@@ -1281,6 +1281,22 @@ namespace xDataService.Helpers
|
||||
//
|
||||
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
|
||||
|
||||
//
|
||||
@@ -1460,7 +1476,7 @@ namespace xDataService.Helpers
|
||||
// Register Graph Type ...
|
||||
source.Add(
|
||||
new ServiceDescriptor(
|
||||
lifetime: ServiceLifetime.Singleton,
|
||||
lifetime: lifetime, // ServiceLifetime.Singleton,
|
||||
serviceType: repositoryDescriptor.GraphType,
|
||||
implementationType: repositoryDescriptor.GraphType
|
||||
)
|
||||
@@ -1470,7 +1486,7 @@ namespace xDataService.Helpers
|
||||
// Register Graph Events ...
|
||||
source.Add(
|
||||
new ServiceDescriptor(
|
||||
lifetime: ServiceLifetime.Singleton,
|
||||
lifetime: lifetime, // ServiceLifetime.Singleton,
|
||||
serviceType: typeof(XBaseGraphQLEventType<TEntity, TKey, TGraph>),
|
||||
implementationType: typeof(XBaseGraphQLEventType<TEntity, TKey, TGraph>)
|
||||
)
|
||||
@@ -1500,14 +1516,14 @@ namespace xDataService.Helpers
|
||||
// Register Graph Schema ...
|
||||
source.Add(
|
||||
new ServiceDescriptor(
|
||||
lifetime: lifetime,
|
||||
serviceType: repositoryDescriptor.GraphSchema,
|
||||
implementationType: repositoryDescriptor.GraphSchema,
|
||||
lifetime: lifetime
|
||||
implementationType: repositoryDescriptor.GraphSchema
|
||||
)
|
||||
);
|
||||
|
||||
//
|
||||
source.AddSingleton<IDocumentExecuter, DocumentExecuter>();
|
||||
source.AddScoped<IDocumentExecuter, DocumentExecuter>();
|
||||
|
||||
//
|
||||
// Register Graph Type Schema ...
|
||||
@@ -1528,9 +1544,12 @@ namespace xDataService.Helpers
|
||||
.AddNewtonsoftJson(deserializerSettings => { }, serializerSettings => { })
|
||||
.AddWebSockets()
|
||||
.AddDataLoader()
|
||||
.AddGraphTypes();
|
||||
.AddGraphTypes(lifetime);
|
||||
}
|
||||
builder.AddGraphTypes(repositoryDescriptor.GraphSchema);
|
||||
builder.AddGraphTypes(
|
||||
serviceLifetime: lifetime,
|
||||
typeFromAssembly: repositoryDescriptor.GraphSchema
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Models;
|
||||
using xModels.Dtos;
|
||||
@@ -30,41 +31,58 @@ namespace xDataService.Interfaces
|
||||
/// </summary>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="forIndex"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<TModel> GetReference(
|
||||
TKey providedForId,
|
||||
int forIndex = 0
|
||||
int forIndex = 0,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all Exists References of Specific Provided ID ...
|
||||
/// </summary>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<TModel>> GetAllReferences(TKey providedForId);
|
||||
Task<IEnumerable<TModel>> GetAllReferences(
|
||||
TKey providedForId,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Extract all Referencing Models for Specified Key ...
|
||||
/// </summary>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XReference<TKey>>> GetAllReferencings(TKey providedForId);
|
||||
Task<IEnumerable<XReference<TKey>>> GetAllReferencings(
|
||||
TKey providedForId,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Count References ...
|
||||
/// </summary>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> CountReferences(TKey providedForId);
|
||||
Task<int> CountReferences(
|
||||
TKey providedForId,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve References of Specific Provided ID as Query ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<TModel>> QueryReferences(
|
||||
XQuery query,
|
||||
TKey providedForId
|
||||
TKey providedForId,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -72,26 +90,29 @@ namespace xDataService.Interfaces
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="forIndex"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddReference(
|
||||
TModel model,
|
||||
TKey providedForId,
|
||||
string connectionId = null
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Add Reference a Model to Specific XRefence<TKey> ...
|
||||
/// Add Reference a Model to Specific XRefence<TKey/> ...
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="reference"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddReference(
|
||||
TModel model,
|
||||
XReference<TKey> reference,
|
||||
string connectionId = null
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -99,26 +120,29 @@ namespace xDataService.Interfaces
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="forIndex">if null, removes all</param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RemoveReference(
|
||||
TModel model,
|
||||
TKey providedForId,
|
||||
string connectionId = null
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Reference a Model for Specific XRefence<TKey> ...
|
||||
/// Remove Reference a Model for Specific XRefence<TKey/> ...
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="reference"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RemoveReference(
|
||||
TModel model,
|
||||
XReference<TKey> reference,
|
||||
string connectionId = null
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -126,10 +150,12 @@ namespace xDataService.Interfaces
|
||||
/// </summary>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RemoveReferences(
|
||||
TKey providedForId,
|
||||
string connectionId = null
|
||||
string connectionId = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
@@ -227,6 +228,22 @@ namespace xDataService.Interfaces
|
||||
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>
|
||||
/// find an Dto by providing a Conditional Expression ...
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
@@ -613,6 +614,42 @@ namespace xDataService.Providers
|
||||
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>
|
||||
/// find an Dto by providing a Conditional Expression ...
|
||||
/// </summary>
|
||||
|
||||
@@ -47,7 +47,6 @@ namespace xDataService.Providers
|
||||
/// <summary>
|
||||
/// Load all Dynamically Registered Entities ...
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public void HandleRegisteredEntities()
|
||||
{
|
||||
//
|
||||
@@ -95,6 +94,7 @@ namespace xDataService.Providers
|
||||
/// Configure all Dynamically Registered Entities ...
|
||||
/// </summary>
|
||||
/// <param name="modelBuilder"></param>
|
||||
/// <param name="names"></param>
|
||||
public void HandleApplyRegisteredEntitiesConfigurations(
|
||||
ModelBuilder modelBuilder,
|
||||
string[] names = null
|
||||
|
||||
+12
-1
@@ -1,4 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!-- Runtime Definitions -->
|
||||
<PropertyGroup>
|
||||
<Version>1.0.0</Version>
|
||||
@@ -7,6 +8,7 @@
|
||||
<Company>SaherElm IT Center</Company>
|
||||
<PackageId>xDashboard.xDataService</PackageId>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
|
||||
<Description>
|
||||
provide base requiremennts for Repository DataBase using and tools for using in xDashboard
|
||||
project.
|
||||
@@ -18,7 +20,8 @@
|
||||
|
||||
<!-- Icon Handling -->
|
||||
<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>
|
||||
|
||||
<!-- Local Modules -->
|
||||
@@ -65,4 +68,12 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.14" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.14" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- For XML Documentation Support -->
|
||||
<PropertyGroup>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user