This commit is contained in:
2026-05-08 04:30:04 +03:30
parent afe5c74d09
commit 34afd95640
20 changed files with 1022 additions and 713 deletions
+13 -5
View File
@@ -1,9 +1,17 @@
using GraphQL.Types;
using xModels.Base;
namespace xDataService.Interfaces {
public interface IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
where TEntity : XBaseEntity<TKey>
where TGraph : IGraphType
where TGraphKey : IGraphType { }
namespace xDataService.Interfaces
{
public interface IXBaseGraphQLQuery { }
public interface IXBaseGraphQLQuery<TEntity, TKey> : IXBaseGraphQLQuery
where TEntity : XBaseEntity<TKey>
{ }
public interface IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey> : IXBaseGraphQLQuery<TEntity, TKey>
where TEntity : XBaseEntity<TKey>
where TGraph : IGraphType
where TGraphKey : IGraphType
{ }
}
+18 -12
View File
@@ -1,21 +1,27 @@
using xModels.Base;
namespace xDataService.Interfaces {
public interface IXBaseGraphQLTypeHelper<TEntity, TKey>
where TEntity : XBaseEntity<TKey> {
string GetInQuerySingleName ();
string GetInQueryCollectionName ();
namespace xDataService.Interfaces
{
public interface IXBaseGraphQLTypeHelper
{
string GetInQuerySingleName();
string GetFindOneName ();
string GetInQueryCollectionName();
string GetFindManyName ();
string GetFindOneName();
string GetQueryName ();
string GetFindManyName();
string GetCountName ();
string GetQueryName();
string GetExistsName ();
string GetCountName();
string GetGraphQLPath (string baseGraphPath = null);
}
string GetExistsName();
string GetGraphQLPath(string baseGraphPath = null);
}
public interface IXBaseGraphQLTypeHelper<TEntity, TKey> : IXBaseGraphQLTypeHelper
where TEntity : XBaseEntity<TKey>
{ }
}
+3 -1
View File
@@ -10,13 +10,15 @@ using xModels.Dtos;
namespace xDataService.Interfaces
{
public interface IXBaseRepository : IDisposable { }
/// <summary>
/// Base Repository Pattern Contracts in XDashboard's Data Service ...
/// use for Data Manipulation ...
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="TKey"></typeparam>
public interface IXBaseRepository<T, TKey> : IDisposable
public interface IXBaseRepository<T, TKey> : IXBaseRepository
where T : XBaseEntity<TKey>
{
//
+113
View File
@@ -0,0 +1,113 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using MongoDB.Bson.Serialization.Conventions;
using xDataService.Configuration;
using xDataService.Constants;
using xDataService.Db;
using xDataService.Models;
namespace xDataService.Interfaces
{
/// <summary>
/// Data Base Descriptor ...
/// </summary>
public interface IXDatabaseDescriptor
{
//
#region Props ...
/// <summary>
/// Database Name ...
/// </summary>
/// <value></value>
string Name { get; set; }
/// <summary>
/// Database Provider ...
/// </summary>
/// <value></value>
XDbProviders Provider { get; set; }
/// <summary>
/// Db Context Type ...
/// </summary>
/// <value></value>
Type Context { get; set; }
/// <summary>
/// Database Connecion String ...
/// </summary>
/// <value></value>
string ConnectionString { get; set; }
/// <summary>
/// Data Service Configuration ...
/// </summary>
/// <value></value>
XDataBaseConfiguration Configuration { get; set; }
/// <summary>
/// Repositories Descriptions ...
/// </summary>
/// <value></value>
IList<XRepositoryDescriptor> Repositories { get; set; }
/// <summary>
/// Mongo Convention Packs ...
/// </summary>
ConventionPack ConventionPacks { get; set; }
/// <summary>
/// DbContext Options Builder ...
/// </summary>
/// <value></value>
Action<dynamic> OptionsBuilder { get; set; }
#endregion
//
#region Configure ...
/// <summary>
/// Configure Database Descriptor using Registered Services ...
/// </summary>
/// <param name="services"></param>
void Configure(
IServiceCollection services
);
/// <summary>
/// Configure Database Descriptor using IConfiguration ...
/// </summary>
/// <param name="configuration"></param>
void Configure(
IConfiguration configuration
);
/// <summary>
/// Configure Database Descriptor using Database Configuration ...
/// </summary>
/// <param name="configuration"></param>
void Configure(
XDataBaseConfiguration configuration
);
/// <summary>
/// Configure Database Descriptor using Provider and Connection String ...
/// </summary>
/// <param name="provider"></param>
/// <param name="connectionString"></param>
void Configure(
XDbProviders provider,
string connectionString
);
#endregion
}
/// <summary>
/// Data Base Descriptor ...
/// </summary>
/// <typeparam name="TContext"></typeparam>
public interface IXDatabaseDescriptor<TContext> : IXDatabaseDescriptor
where TContext : XDbContext
{ }
}
+21 -9
View File
@@ -2,13 +2,25 @@ using System.Threading;
using System.Threading.Tasks;
using xModels.Base;
namespace xDataService.Interfaces {
public interface IXKeyGenerator<TEntity, TKey>
where TEntity : XBaseEntity<TKey> {
bool IsEmpty (TKey id);
Task<TKey> GenerateKey (
IXBaseRepository<TEntity, TKey> repository,
CancellationToken cancellationToken = default
);
}
namespace xDataService.Interfaces
{
/// <summary>
/// Non Generic Key Generator Interface ...
/// </summary>
public interface IXKeyGenerator { }
/// <summary>
/// Typed Base Key Generator ...
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <typeparam name="TKey"></typeparam>
public interface IXKeyGenerator<TEntity, TKey> : IXKeyGenerator
where TEntity : XBaseEntity<TKey>
{
bool IsEmpty(TKey id);
Task<TKey> GenerateKey(
IXBaseRepository<TEntity, TKey> repository,
CancellationToken cancellationToken = default
);
}
}