fix GraphQL DI Registration Using Generics ...
This commit is contained in:
@@ -135,7 +135,7 @@ namespace xDataService.DI
|
|||||||
if (!isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Log("DataService Configuration notProvided ...");
|
Log("DataService Configuration not provided ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,10 +176,8 @@ namespace xDataService.DI
|
|||||||
runtimeType: descriptor.Context,
|
runtimeType: descriptor.Context,
|
||||||
args: [
|
args: [
|
||||||
source,
|
source,
|
||||||
descriptor.Provider,
|
descriptor,
|
||||||
descriptor.ConnectionString,
|
lifetime
|
||||||
lifetime,
|
|
||||||
descriptor.OptionsBuilder
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
|
using xDataService.Constants;
|
||||||
using xDataService.Models;
|
using xDataService.Models;
|
||||||
|
|
||||||
namespace xDataService.Extensions
|
namespace xDataService.Extensions
|
||||||
@@ -21,6 +22,22 @@ namespace xDataService.Extensions
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Chack a Descriptor Has Provider or not ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool HasProvider(this XDatabaseDescriptor source)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result =
|
||||||
|
source.IsValid() &&
|
||||||
|
source.Provider != XDbProviders.None;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check a Descriptor Has EF Core Context or not ...
|
/// Check a Descriptor Has EF Core Context or not ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -31,6 +48,8 @@ namespace xDataService.Extensions
|
|||||||
//
|
//
|
||||||
var result =
|
var result =
|
||||||
source.IsValid() &&
|
source.IsValid() &&
|
||||||
|
source.HasProvider() &&
|
||||||
|
source.Provider != XDbProviders.MongoDB &&
|
||||||
!source.Context.IsNull();
|
!source.Context.IsNull();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -47,11 +66,30 @@ namespace xDataService.Extensions
|
|||||||
//
|
//
|
||||||
var result =
|
var result =
|
||||||
source.IsValid() &&
|
source.IsValid() &&
|
||||||
|
source.HasProvider() &&
|
||||||
!source.Repositories.IsNull() &&
|
!source.Repositories.IsNull() &&
|
||||||
source.Repositories.HasChild();
|
source.Repositories.HasChild();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check a Descriptor Has MongoDB Convention Packs ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool HasConventionPacks(this XDatabaseDescriptor source)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result =
|
||||||
|
source.IsValid() &&
|
||||||
|
source.HasProvider() &&
|
||||||
|
source.Provider == XDbProviders.MongoDB &&
|
||||||
|
!source.ConventionPacks.IsNull();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,11 +65,10 @@ namespace xDataService.Extensions
|
|||||||
var result =
|
var result =
|
||||||
source.IsValid() &&
|
source.IsValid() &&
|
||||||
!source.GraphType.IsNull() &&
|
!source.GraphType.IsNull() &&
|
||||||
|
!source.GraphQuery.IsNull() &&
|
||||||
!source.GraphSchema.IsNull() &&
|
!source.GraphSchema.IsNull() &&
|
||||||
!source.GraphTypeKey.IsNull() &&
|
!source.GraphTypeKey.IsNull() &&
|
||||||
!source.GraphQueryService.IsNull() &&
|
|
||||||
!source.GraphTypeHelperService.IsNull() &&
|
!source.GraphTypeHelperService.IsNull() &&
|
||||||
!source.GraphQueryImplementation.IsNull() &&
|
|
||||||
!source.GraphTypeHelperImplementation.IsNull();
|
!source.GraphTypeHelperImplementation.IsNull();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
+307
-106
@@ -4,6 +4,8 @@ using GraphQL.Types;
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using MongoDB.Bson.Serialization;
|
||||||
|
using MongoDB.Bson.Serialization.Conventions;
|
||||||
using MySql.EntityFrameworkCore.Extensions;
|
using MySql.EntityFrameworkCore.Extensions;
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
using xDataService.Constants;
|
using xDataService.Constants;
|
||||||
@@ -28,30 +30,27 @@ namespace xDataService.Helpers
|
|||||||
/// Register DbContext ...
|
/// Register DbContext ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="source"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="provider"></param>
|
/// <param name="databaseDescriptor"></param>
|
||||||
/// <param name="connectionString"></param>
|
|
||||||
/// <param name="lifetime"></param>
|
/// <param name="lifetime"></param>
|
||||||
/// <param name="optionsBuilder"></param>
|
|
||||||
/// <typeparam name="TContext"></typeparam>
|
/// <typeparam name="TContext"></typeparam>
|
||||||
public static void AddXDbContext<TContext>(
|
public static void AddXDbContext<TContext>(
|
||||||
IServiceCollection source,
|
IServiceCollection source,
|
||||||
XDbProviders provider,
|
XDatabaseDescriptor databaseDescriptor,
|
||||||
string connectionString,
|
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
||||||
ServiceLifetime lifetime = ServiceLifetime.Scoped,
|
|
||||||
Action<dynamic> optionsBuilder = null
|
|
||||||
)
|
)
|
||||||
where TContext : XDbContext
|
where TContext : XDbContext
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (provider == XDbProviders.None)
|
var isValid =
|
||||||
|
databaseDescriptor.IsValid() &&
|
||||||
|
databaseDescriptor.HasProvider();
|
||||||
|
if (!isValid)
|
||||||
{
|
{
|
||||||
//
|
XException.InvalidConfiguration.Throw();
|
||||||
// Log("Invalid Db Provider ...");
|
|
||||||
XException.InvalidArgs.Throw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
switch (provider)
|
switch (databaseDescriptor.Provider)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// MySQL ...
|
// MySQL ...
|
||||||
@@ -60,7 +59,11 @@ namespace xDataService.Helpers
|
|||||||
source.AddEntityFrameworkMySQL();
|
source.AddEntityFrameworkMySQL();
|
||||||
source.AddDbContext<TContext>(cfg =>
|
source.AddDbContext<TContext>(cfg =>
|
||||||
{
|
{
|
||||||
cfg.UseMySQL(connectionString, optionsBuilder);
|
//
|
||||||
|
cfg.UseMySQL(
|
||||||
|
databaseDescriptor.ConnectionString,
|
||||||
|
databaseDescriptor.OptionsBuilder
|
||||||
|
);
|
||||||
}, lifetime);
|
}, lifetime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -71,7 +74,11 @@ namespace xDataService.Helpers
|
|||||||
source.AddEntityFrameworkSqlite();
|
source.AddEntityFrameworkSqlite();
|
||||||
source.AddDbContext<TContext>(cfg =>
|
source.AddDbContext<TContext>(cfg =>
|
||||||
{
|
{
|
||||||
cfg.UseSqlite(connectionString, optionsBuilder);
|
//
|
||||||
|
cfg.UseSqlite(
|
||||||
|
databaseDescriptor.ConnectionString,
|
||||||
|
databaseDescriptor.OptionsBuilder
|
||||||
|
);
|
||||||
}, lifetime);
|
}, lifetime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -82,21 +89,70 @@ namespace xDataService.Helpers
|
|||||||
source.AddEntityFrameworkSqlServer();
|
source.AddEntityFrameworkSqlServer();
|
||||||
source.AddDbContext<TContext>(cfg =>
|
source.AddDbContext<TContext>(cfg =>
|
||||||
{
|
{
|
||||||
cfg.UseSqlServer(connectionString, optionsBuilder);
|
//
|
||||||
|
cfg.UseSqlServer(
|
||||||
|
databaseDescriptor.ConnectionString,
|
||||||
|
databaseDescriptor.OptionsBuilder
|
||||||
|
);
|
||||||
}, lifetime);
|
}, lifetime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Mongo DB ...
|
||||||
case XDbProviders.MongoDB:
|
case XDbProviders.MongoDB:
|
||||||
// There is notRequired to Register DBConext forMongo DB ...
|
//
|
||||||
|
#region XBaseEntity Mappers ...
|
||||||
|
//
|
||||||
|
// Map ID as BsonId here ...
|
||||||
|
BsonClassMap.RegisterClassMap<XBaseEntity<Guid>>(cm =>
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cm.AutoMap();
|
||||||
|
cm.MapIdMember(c => c.Id);
|
||||||
|
});
|
||||||
|
BsonClassMap.RegisterClassMap<XBaseEntity<int>>(cm =>
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cm.AutoMap();
|
||||||
|
cm.MapIdMember(c => c.Id);
|
||||||
|
});
|
||||||
|
BsonClassMap.RegisterClassMap<XBaseEntity<long>>(cm =>
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cm.AutoMap();
|
||||||
|
cm.MapIdMember(c => c.Id);
|
||||||
|
});
|
||||||
|
BsonClassMap.RegisterClassMap<XBaseEntity<string>>(cm =>
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cm.AutoMap();
|
||||||
|
cm.MapIdMember(c => c.Id);
|
||||||
|
});
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Has Convention Packs ...
|
||||||
|
isValid = databaseDescriptor.HasConventionPacks();
|
||||||
|
if (isValid)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ConventionRegistry.Register(
|
||||||
|
nameof(
|
||||||
|
databaseDescriptor.ConventionPacks
|
||||||
|
),
|
||||||
|
databaseDescriptor.ConventionPacks,
|
||||||
|
type => !type.FullName
|
||||||
|
.IsNullOrEmpty()
|
||||||
|
);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
var isValid =
|
isValid =
|
||||||
provider == XDbProviders.MySQL ||
|
databaseDescriptor.Provider == XDbProviders.MySQL ||
|
||||||
provider == XDbProviders.SQLite ||
|
databaseDescriptor.Provider == XDbProviders.SQLite ||
|
||||||
provider == XDbProviders.SQLServer;
|
databaseDescriptor.Provider == XDbProviders.SQLServer;
|
||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -144,7 +200,12 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TKeyGeneratorService"></typeparam>
|
/// <typeparam name="TKeyGeneratorService"></typeparam>
|
||||||
/// <typeparam name="TKeyGeneratorImplementation"></typeparam>
|
/// <typeparam name="TKeyGeneratorImplementation"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void AddXRepository<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation>(
|
public static void AddXRepository<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation
|
||||||
|
>(
|
||||||
IServiceCollection source,
|
IServiceCollection source,
|
||||||
XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation> repositoryDescriptor,
|
XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation> repositoryDescriptor,
|
||||||
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
||||||
@@ -187,7 +248,14 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TEventsService"></typeparam>
|
/// <typeparam name="TEventsService"></typeparam>
|
||||||
/// <typeparam name="TEventsImplementation"></typeparam>
|
/// <typeparam name="TEventsImplementation"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void AddXRepository<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation>(
|
public static void AddXRepository<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation
|
||||||
|
>(
|
||||||
IServiceCollection source,
|
IServiceCollection source,
|
||||||
XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation> repositoryDescriptor,
|
XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation> repositoryDescriptor,
|
||||||
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
||||||
@@ -246,15 +314,27 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TEventsImplementation"></typeparam>
|
/// <typeparam name="TEventsImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraph"></typeparam>
|
/// <typeparam name="TGraph"></typeparam>
|
||||||
/// <typeparam name="TGraphKey"></typeparam>
|
/// <typeparam name="TGraphKey"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryService"></typeparam>
|
/// <typeparam name="TGraphQuery"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryImplementation"></typeparam>
|
|
||||||
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
||||||
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraphSchema"></typeparam>
|
/// <typeparam name="TGraphSchema"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void AddXRepository<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
public static void AddXRepository<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema
|
||||||
|
>(
|
||||||
IServiceCollection source,
|
IServiceCollection source,
|
||||||
XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema> repositoryDescriptor,
|
XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema> repositoryDescriptor,
|
||||||
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
||||||
)
|
)
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
@@ -266,9 +346,8 @@ namespace xDataService.Helpers
|
|||||||
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var isValid = repositoryDescriptor.IsValid();
|
var isValid = repositoryDescriptor.IsValid();
|
||||||
@@ -309,7 +388,7 @@ namespace xDataService.Helpers
|
|||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
AddXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
AddXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
||||||
source,
|
source,
|
||||||
repositoryDescriptor,
|
repositoryDescriptor,
|
||||||
lifetime
|
lifetime
|
||||||
@@ -331,17 +410,31 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TEventsImplementation"></typeparam>
|
/// <typeparam name="TEventsImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraph"></typeparam>
|
/// <typeparam name="TGraph"></typeparam>
|
||||||
/// <typeparam name="TGraphKey"></typeparam>
|
/// <typeparam name="TGraphKey"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryService"></typeparam>
|
/// <typeparam name="TGraphQuery"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryImplementation"></typeparam>
|
|
||||||
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
||||||
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraphSchema"></typeparam>
|
/// <typeparam name="TGraphSchema"></typeparam>
|
||||||
/// <typeparam name="TRepositoryService"></typeparam>
|
/// <typeparam name="TRepositoryService"></typeparam>
|
||||||
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void AddXRepository<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation>(
|
public static void AddXRepository<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema,
|
||||||
|
TRepositoryService,
|
||||||
|
TRepositoryImplementation
|
||||||
|
>(
|
||||||
IServiceCollection source,
|
IServiceCollection source,
|
||||||
XInMemoryRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation> repositoryDescriptor,
|
XInMemoryRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation> repositoryDescriptor,
|
||||||
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
||||||
)
|
)
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
@@ -354,10 +447,9 @@ namespace xDataService.Helpers
|
|||||||
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TRepositoryImplementation : XBaseInMemoryRepositoy<TEntity, TKey>
|
where TRepositoryImplementation : XBaseInMemoryRepositoy<TEntity, TKey>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var isValid = repositoryDescriptor.IsValid();
|
var isValid = repositoryDescriptor.IsValid();
|
||||||
@@ -398,7 +490,7 @@ namespace xDataService.Helpers
|
|||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
AddXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
AddXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
||||||
source,
|
source,
|
||||||
repositoryDescriptor,
|
repositoryDescriptor,
|
||||||
lifetime
|
lifetime
|
||||||
@@ -435,17 +527,31 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TEventsImplementation"></typeparam>
|
/// <typeparam name="TEventsImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraph"></typeparam>
|
/// <typeparam name="TGraph"></typeparam>
|
||||||
/// <typeparam name="TGraphKey"></typeparam>
|
/// <typeparam name="TGraphKey"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryService"></typeparam>
|
/// <typeparam name="TGraphQuery"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryImplementation"></typeparam>
|
|
||||||
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
||||||
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraphSchema"></typeparam>
|
/// <typeparam name="TGraphSchema"></typeparam>
|
||||||
/// <typeparam name="TRepositoryService"></typeparam>
|
/// <typeparam name="TRepositoryService"></typeparam>
|
||||||
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void AddXRepository<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation>(
|
public static void AddXRepository<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema,
|
||||||
|
TRepositoryService,
|
||||||
|
TRepositoryImplementation
|
||||||
|
>(
|
||||||
IServiceCollection source,
|
IServiceCollection source,
|
||||||
XMongoRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation> repositoryDescriptor,
|
XMongoRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation> repositoryDescriptor,
|
||||||
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
||||||
)
|
)
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
@@ -457,11 +563,10 @@ namespace xDataService.Helpers
|
|||||||
where TRepositoryService : IXBaseRepository<TEntity, TKey>
|
where TRepositoryService : IXBaseRepository<TEntity, TKey>
|
||||||
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
|
||||||
where TRepositoryImplementation : XBaseMongoRepository<TEntity, TKey>
|
where TRepositoryImplementation : XBaseMongoRepository<TEntity, TKey>
|
||||||
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var isValid = repositoryDescriptor.IsValid();
|
var isValid = repositoryDescriptor.IsValid();
|
||||||
@@ -502,7 +607,7 @@ namespace xDataService.Helpers
|
|||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
AddXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
AddXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
||||||
source,
|
source,
|
||||||
repositoryDescriptor,
|
repositoryDescriptor,
|
||||||
lifetime
|
lifetime
|
||||||
@@ -539,8 +644,7 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TEventsImplementation"></typeparam>
|
/// <typeparam name="TEventsImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraph"></typeparam>
|
/// <typeparam name="TGraph"></typeparam>
|
||||||
/// <typeparam name="TGraphKey"></typeparam>
|
/// <typeparam name="TGraphKey"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryService"></typeparam>
|
/// <typeparam name="TGraphQuery"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryImplementation"></typeparam>
|
|
||||||
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
||||||
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraphSchema"></typeparam>
|
/// <typeparam name="TGraphSchema"></typeparam>
|
||||||
@@ -548,9 +652,25 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
||||||
/// <typeparam name="TContext"></typeparam>
|
/// <typeparam name="TContext"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void AddXRepository<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation, TContext>(
|
public static void AddXRepository<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema,
|
||||||
|
TRepositoryService,
|
||||||
|
TRepositoryImplementation,
|
||||||
|
TContext
|
||||||
|
>(
|
||||||
IServiceCollection source,
|
IServiceCollection source,
|
||||||
XEFRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation, TContext> repositoryDescriptor,
|
XEFRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation, TContext> repositoryDescriptor,
|
||||||
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
||||||
)
|
)
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
@@ -564,10 +684,9 @@ namespace xDataService.Helpers
|
|||||||
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TRepositoryImplementation : XBaseEFRepository<TEntity, TKey, TContext>
|
where TRepositoryImplementation : XBaseEFRepository<TEntity, TKey, TContext>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var isValid = repositoryDescriptor.IsValid();
|
var isValid = repositoryDescriptor.IsValid();
|
||||||
@@ -608,7 +727,7 @@ namespace xDataService.Helpers
|
|||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
AddXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
AddXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
||||||
source,
|
source,
|
||||||
repositoryDescriptor,
|
repositoryDescriptor,
|
||||||
lifetime
|
lifetime
|
||||||
@@ -645,17 +764,31 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TEventsImplementation"></typeparam>
|
/// <typeparam name="TEventsImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraph"></typeparam>
|
/// <typeparam name="TGraph"></typeparam>
|
||||||
/// <typeparam name="TGraphKey"></typeparam>
|
/// <typeparam name="TGraphKey"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryService"></typeparam>
|
/// <typeparam name="TGraphQuery"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryImplementation"></typeparam>
|
|
||||||
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
||||||
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraphSchema"></typeparam>
|
/// <typeparam name="TGraphSchema"></typeparam>
|
||||||
/// <typeparam name="TRepositoryService"></typeparam>
|
/// <typeparam name="TRepositoryService"></typeparam>
|
||||||
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void UseXRepository<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation>(
|
public static void UseXRepository<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema,
|
||||||
|
TRepositoryService,
|
||||||
|
TRepositoryImplementation
|
||||||
|
>(
|
||||||
IApplicationBuilder source,
|
IApplicationBuilder source,
|
||||||
XInMemoryRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation> repositoryDescriptor
|
XInMemoryRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation> repositoryDescriptor
|
||||||
)
|
)
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
where TGraphKey : IGraphType
|
where TGraphKey : IGraphType
|
||||||
@@ -668,9 +801,8 @@ namespace xDataService.Helpers
|
|||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TRepositoryImplementation : XBaseInMemoryRepositoy<TEntity, TKey>
|
where TRepositoryImplementation : XBaseInMemoryRepositoy<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var isValid = repositoryDescriptor.IsValid();
|
var isValid = repositoryDescriptor.IsValid();
|
||||||
@@ -685,7 +817,7 @@ namespace xDataService.Helpers
|
|||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
UseXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
UseXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
||||||
source,
|
source,
|
||||||
repositoryDescriptor
|
repositoryDescriptor
|
||||||
);
|
);
|
||||||
@@ -706,17 +838,31 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TEventsImplementation"></typeparam>
|
/// <typeparam name="TEventsImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraph"></typeparam>
|
/// <typeparam name="TGraph"></typeparam>
|
||||||
/// <typeparam name="TGraphKey"></typeparam>
|
/// <typeparam name="TGraphKey"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryService"></typeparam>
|
/// <typeparam name="TGraphQuery"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryImplementation"></typeparam>
|
|
||||||
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
||||||
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraphSchema"></typeparam>
|
/// <typeparam name="TGraphSchema"></typeparam>
|
||||||
/// <typeparam name="TRepositoryService"></typeparam>
|
/// <typeparam name="TRepositoryService"></typeparam>
|
||||||
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void UseXRepository<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation>(
|
public static void UseXRepository<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema,
|
||||||
|
TRepositoryService,
|
||||||
|
TRepositoryImplementation
|
||||||
|
>(
|
||||||
IApplicationBuilder source,
|
IApplicationBuilder source,
|
||||||
XMongoRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation> repositoryDescriptor
|
XMongoRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation> repositoryDescriptor
|
||||||
)
|
)
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
where TGraphKey : IGraphType
|
where TGraphKey : IGraphType
|
||||||
@@ -727,11 +873,10 @@ namespace xDataService.Helpers
|
|||||||
where TRepositoryService : IXBaseRepository<TEntity, TKey>
|
where TRepositoryService : IXBaseRepository<TEntity, TKey>
|
||||||
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
|
||||||
where TRepositoryImplementation : XBaseMongoRepository<TEntity, TKey>
|
where TRepositoryImplementation : XBaseMongoRepository<TEntity, TKey>
|
||||||
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var isValid = repositoryDescriptor.IsValid();
|
var isValid = repositoryDescriptor.IsValid();
|
||||||
@@ -746,7 +891,7 @@ namespace xDataService.Helpers
|
|||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
UseXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
UseXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
||||||
source,
|
source,
|
||||||
repositoryDescriptor
|
repositoryDescriptor
|
||||||
);
|
);
|
||||||
@@ -766,8 +911,7 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TEventsImplementation"></typeparam>
|
/// <typeparam name="TEventsImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraph"></typeparam>
|
/// <typeparam name="TGraph"></typeparam>
|
||||||
/// <typeparam name="TGraphKey"></typeparam>
|
/// <typeparam name="TGraphKey"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryService"></typeparam>
|
/// <typeparam name="TGraphQuery"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryImplementation"></typeparam>
|
|
||||||
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
||||||
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraphSchema"></typeparam>
|
/// <typeparam name="TGraphSchema"></typeparam>
|
||||||
@@ -775,9 +919,25 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
/// <typeparam name="TRepositoryImplementation"></typeparam>
|
||||||
/// <typeparam name="TContext"></typeparam>
|
/// <typeparam name="TContext"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void UseXRepository<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation, TContext>(
|
public static void UseXRepository<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema,
|
||||||
|
TRepositoryService,
|
||||||
|
TRepositoryImplementation,
|
||||||
|
TContext
|
||||||
|
>(
|
||||||
IApplicationBuilder source,
|
IApplicationBuilder source,
|
||||||
XEFRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation, TContext> repositoryDescriptor
|
XEFRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation, TContext> repositoryDescriptor
|
||||||
)
|
)
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
where TContext : XDbContext
|
where TContext : XDbContext
|
||||||
@@ -790,10 +950,9 @@ namespace xDataService.Helpers
|
|||||||
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TRepositoryImplementation : XBaseEFRepository<TEntity, TKey, TContext>
|
where TRepositoryImplementation : XBaseEFRepository<TEntity, TKey, TContext>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var isValid = repositoryDescriptor.IsValid();
|
var isValid = repositoryDescriptor.IsValid();
|
||||||
@@ -808,7 +967,7 @@ namespace xDataService.Helpers
|
|||||||
if (isValid)
|
if (isValid)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
UseXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
UseXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQuery, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
||||||
source,
|
source,
|
||||||
repositoryDescriptor
|
repositoryDescriptor
|
||||||
);
|
);
|
||||||
@@ -851,7 +1010,12 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TKeyGeneratorService"></typeparam>
|
/// <typeparam name="TKeyGeneratorService"></typeparam>
|
||||||
/// <typeparam name="TKeyGeneratorImplementation"></typeparam>
|
/// <typeparam name="TKeyGeneratorImplementation"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void AddXKeyGenerator<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation>(
|
public static void AddXKeyGenerator<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation
|
||||||
|
>(
|
||||||
IServiceCollection source,
|
IServiceCollection source,
|
||||||
XRepositoryDescriptor<TEntity, TKey> repositoryDescriptor,
|
XRepositoryDescriptor<TEntity, TKey> repositoryDescriptor,
|
||||||
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
||||||
@@ -894,7 +1058,12 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TEventsService"></typeparam>
|
/// <typeparam name="TEventsService"></typeparam>
|
||||||
/// <typeparam name="TEventsImplementation"></typeparam>
|
/// <typeparam name="TEventsImplementation"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void AddXEvents<TEntity, TKey, TEventsService, TEventsImplementation>(
|
public static void AddXEvents<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation
|
||||||
|
>(
|
||||||
IServiceCollection source,
|
IServiceCollection source,
|
||||||
XRepositoryDescriptor<TEntity, TKey> repositoryDescriptor,
|
XRepositoryDescriptor<TEntity, TKey> repositoryDescriptor,
|
||||||
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
||||||
@@ -936,13 +1105,21 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TKey"></typeparam>
|
/// <typeparam name="TKey"></typeparam>
|
||||||
/// <typeparam name="TGraph"></typeparam>
|
/// <typeparam name="TGraph"></typeparam>
|
||||||
/// <typeparam name="TGraphKey"></typeparam>
|
/// <typeparam name="TGraphKey"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryService"></typeparam>
|
/// <typeparam name="TGraphQuery"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryImplementation"></typeparam>
|
|
||||||
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
||||||
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraphSchema"></typeparam>
|
/// <typeparam name="TGraphSchema"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void AddXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
public static void AddXGraphQL<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema
|
||||||
|
>(
|
||||||
IServiceCollection source,
|
IServiceCollection source,
|
||||||
XRepositoryDescriptor<TEntity, TKey> repositoryDescriptor,
|
XRepositoryDescriptor<TEntity, TKey> repositoryDescriptor,
|
||||||
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
ServiceLifetime lifetime = ServiceLifetime.Scoped
|
||||||
@@ -952,9 +1129,8 @@ namespace xDataService.Helpers
|
|||||||
where TEntity : XBaseEntity<TKey>
|
where TEntity : XBaseEntity<TKey>
|
||||||
where TGraph : XBaseGraphObjectType<TEntity, TKey>
|
where TGraph : XBaseGraphObjectType<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Validate ...
|
// Validate ...
|
||||||
@@ -962,32 +1138,16 @@ namespace xDataService.Helpers
|
|||||||
!source.IsNull() &&
|
!source.IsNull() &&
|
||||||
!repositoryDescriptor.IsNull() &&
|
!repositoryDescriptor.IsNull() &&
|
||||||
!repositoryDescriptor.GraphType.IsNull() &&
|
!repositoryDescriptor.GraphType.IsNull() &&
|
||||||
|
!repositoryDescriptor.GraphQuery.IsNull() &&
|
||||||
!repositoryDescriptor.GraphSchema.IsNull() &&
|
!repositoryDescriptor.GraphSchema.IsNull() &&
|
||||||
!repositoryDescriptor.GraphTypeKey.IsNull() &&
|
!repositoryDescriptor.GraphTypeKey.IsNull() &&
|
||||||
!repositoryDescriptor.GraphQueryService.IsNull() &&
|
|
||||||
!repositoryDescriptor.GraphTypeHelperService.IsNull() &&
|
!repositoryDescriptor.GraphTypeHelperService.IsNull() &&
|
||||||
!repositoryDescriptor.GraphQueryImplementation.IsNull() &&
|
|
||||||
!repositoryDescriptor.GraphTypeHelperImplementation.IsNull();
|
!repositoryDescriptor.GraphTypeHelperImplementation.IsNull();
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Register Graph Type ...
|
|
||||||
var builder = source.GetRegisteredService<IGraphQLBuilder>();
|
|
||||||
if (builder.IsNull())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Action<GraphQLOptions> options = x => { };
|
|
||||||
builder = source.AddGraphQL(options)
|
|
||||||
.AddNewtonsoftJson(deserializerSettings => { }, serializerSettings => { })
|
|
||||||
.AddWebSockets()
|
|
||||||
.AddDataLoader()
|
|
||||||
.AddGraphTypes();
|
|
||||||
}
|
|
||||||
builder.AddGraphTypes(repositoryDescriptor.GraphType);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register Graph Schema ...
|
// Register Graph Schema ...
|
||||||
source.Add(
|
source.Add(
|
||||||
@@ -1002,8 +1162,8 @@ namespace xDataService.Helpers
|
|||||||
// Register Graph Query ...
|
// Register Graph Query ...
|
||||||
source.Add(
|
source.Add(
|
||||||
new ServiceDescriptor(
|
new ServiceDescriptor(
|
||||||
repositoryDescriptor.GraphQueryService,
|
repositoryDescriptor.GraphQuery,
|
||||||
repositoryDescriptor.GraphQueryImplementation,
|
repositoryDescriptor.GraphQuery,
|
||||||
lifetime
|
lifetime
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -1017,6 +1177,41 @@ namespace xDataService.Helpers
|
|||||||
lifetime: ServiceLifetime.Singleton
|
lifetime: ServiceLifetime.Singleton
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register Graph Type ...
|
||||||
|
source.Add(
|
||||||
|
new ServiceDescriptor(
|
||||||
|
repositoryDescriptor.GraphType,
|
||||||
|
repositoryDescriptor.GraphType,
|
||||||
|
ServiceLifetime.Singleton
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register Graph Events ...
|
||||||
|
source.Add(
|
||||||
|
new ServiceDescriptor(
|
||||||
|
typeof(XBaseGraphQLEventType<TEntity, TKey, TGraph>),
|
||||||
|
typeof(XBaseGraphQLEventType<TEntity, TKey, TGraph>),
|
||||||
|
ServiceLifetime.Singleton
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register Graph Type Schema ...
|
||||||
|
var builder = source.GetRegisteredService<IGraphQLBuilder>();
|
||||||
|
if (builder.IsNull())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Action<GraphQLOptions> options = x => { };
|
||||||
|
builder = source.AddGraphQL(options)
|
||||||
|
.AddNewtonsoftJson(deserializerSettings => { }, serializerSettings => { })
|
||||||
|
.AddWebSockets()
|
||||||
|
.AddDataLoader()
|
||||||
|
.AddGraphTypes();
|
||||||
|
}
|
||||||
|
builder.AddGraphTypes(repositoryDescriptor.GraphSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1029,13 +1224,21 @@ namespace xDataService.Helpers
|
|||||||
/// <typeparam name="TKey"></typeparam>
|
/// <typeparam name="TKey"></typeparam>
|
||||||
/// <typeparam name="TGraph"></typeparam>
|
/// <typeparam name="TGraph"></typeparam>
|
||||||
/// <typeparam name="TGraphKey"></typeparam>
|
/// <typeparam name="TGraphKey"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryService"></typeparam>
|
/// <typeparam name="TGraphQuery"></typeparam>
|
||||||
/// <typeparam name="TGraphQueryImplementation"></typeparam>
|
|
||||||
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
/// <typeparam name="TGraphTypeHelperService"></typeparam>
|
||||||
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
/// <typeparam name="TGraphTypeHelperImplementation"></typeparam>
|
||||||
/// <typeparam name="TGraphSchema"></typeparam>
|
/// <typeparam name="TGraphSchema"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void UseXGraphQL<TEntity, TKey, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>(
|
public static void UseXGraphQL<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema
|
||||||
|
>(
|
||||||
IApplicationBuilder source,
|
IApplicationBuilder source,
|
||||||
XRepositoryDescriptor<TEntity, TKey> repositoryDescriptor
|
XRepositoryDescriptor<TEntity, TKey> repositoryDescriptor
|
||||||
)
|
)
|
||||||
@@ -1044,9 +1247,8 @@ namespace xDataService.Helpers
|
|||||||
where TEntity : XBaseEntity<TKey>
|
where TEntity : XBaseEntity<TKey>
|
||||||
where TGraph : XBaseGraphObjectType<TEntity, TKey>
|
where TGraph : XBaseGraphObjectType<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Validate ...
|
// Validate ...
|
||||||
@@ -1054,11 +1256,10 @@ namespace xDataService.Helpers
|
|||||||
!source.IsNull() &&
|
!source.IsNull() &&
|
||||||
!repositoryDescriptor.IsNull() &&
|
!repositoryDescriptor.IsNull() &&
|
||||||
!repositoryDescriptor.GraphType.IsNull() &&
|
!repositoryDescriptor.GraphType.IsNull() &&
|
||||||
|
!repositoryDescriptor.GraphQuery.IsNull() &&
|
||||||
!repositoryDescriptor.GraphSchema.IsNull() &&
|
!repositoryDescriptor.GraphSchema.IsNull() &&
|
||||||
!repositoryDescriptor.GraphTypeKey.IsNull() &&
|
!repositoryDescriptor.GraphTypeKey.IsNull() &&
|
||||||
!repositoryDescriptor.GraphQueryService.IsNull() &&
|
|
||||||
!repositoryDescriptor.GraphTypeHelperService.IsNull() &&
|
!repositoryDescriptor.GraphTypeHelperService.IsNull() &&
|
||||||
!repositoryDescriptor.GraphQueryImplementation.IsNull() &&
|
|
||||||
!repositoryDescriptor.GraphTypeHelperImplementation.IsNull();
|
!repositoryDescriptor.GraphTypeHelperImplementation.IsNull();
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
|
|||||||
+134
-23
@@ -69,13 +69,7 @@ namespace xDataService.Models
|
|||||||
/// Entity GrapQL Query ...
|
/// Entity GrapQL Query ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public Type GraphQueryService { get; set; } = null;
|
public Type GraphQuery { get; set; } = null;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Entity GrapQL Query ...
|
|
||||||
/// </summary>
|
|
||||||
/// <value></value>
|
|
||||||
public Type GraphQueryImplementation { get; set; } = null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Repository Event Provider ...
|
/// Repository Event Provider ...
|
||||||
@@ -133,7 +127,12 @@ namespace xDataService.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// a Repository Descriptor ...
|
/// a Repository Descriptor ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation> : XRepositoryDescriptor<TEntity, TKey>
|
public class XRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation
|
||||||
|
> : XRepositoryDescriptor<TEntity, TKey>
|
||||||
where TEntity : XBaseEntity<TKey>
|
where TEntity : XBaseEntity<TKey>
|
||||||
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
@@ -149,7 +148,19 @@ namespace xDataService.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// a Repository Descriptor ...
|
/// a Repository Descriptor ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation> : XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation>
|
public class XRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation
|
||||||
|
> : XRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation
|
||||||
|
>
|
||||||
where TEntity : XBaseEntity<TKey>
|
where TEntity : XBaseEntity<TKey>
|
||||||
where TEventsService : IXBaseRepositoryEvents<TEntity>
|
where TEventsService : IXBaseRepositoryEvents<TEntity>
|
||||||
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
||||||
@@ -167,7 +178,27 @@ namespace xDataService.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// a Repository Descriptor ...
|
/// a Repository Descriptor ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema> : XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation>
|
public class XRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema
|
||||||
|
> : XRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation
|
||||||
|
>
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
where TGraphKey : IGraphType
|
where TGraphKey : IGraphType
|
||||||
where TEntity : XBaseEntity<TKey>
|
where TEntity : XBaseEntity<TKey>
|
||||||
@@ -177,19 +208,17 @@ namespace xDataService.Models
|
|||||||
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
public XRepositoryDescriptor() : base()
|
public XRepositoryDescriptor() : base()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
GraphType = typeof(TGraph);
|
GraphType = typeof(TGraph);
|
||||||
GraphTypeKey = typeof(TGraphKey);
|
GraphTypeKey = typeof(TGraphKey);
|
||||||
|
GraphQuery = typeof(TGraphQuery);
|
||||||
GraphSchema = typeof(TGraphSchema);
|
GraphSchema = typeof(TGraphSchema);
|
||||||
GraphQueryService = typeof(TGraphQueryService);
|
|
||||||
GraphTypeHelperService = typeof(TGraphTypeHelperService);
|
GraphTypeHelperService = typeof(TGraphTypeHelperService);
|
||||||
GraphQueryImplementation = typeof(TGraphQueryImplementation);
|
|
||||||
GraphTypeHelperImplementation = typeof(TGraphTypeHelperImplementation);
|
GraphTypeHelperImplementation = typeof(TGraphTypeHelperImplementation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +226,35 @@ namespace xDataService.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// a Repository Descriptor ...
|
/// a Repository Descriptor ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XInMemoryRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation> : XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>
|
public class XInMemoryRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema,
|
||||||
|
TRepositoryService,
|
||||||
|
TRepositoryImplementation
|
||||||
|
> : XRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema
|
||||||
|
>
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
where TGraphKey : IGraphType
|
where TGraphKey : IGraphType
|
||||||
where TEntity : XBaseEntity<TKey>
|
where TEntity : XBaseEntity<TKey>
|
||||||
@@ -209,9 +266,8 @@ namespace xDataService.Models
|
|||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TRepositoryImplementation : XBaseInMemoryRepositoy<TEntity, TKey>
|
where TRepositoryImplementation : XBaseInMemoryRepositoy<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
public XInMemoryRepositoryDescriptor() : base()
|
public XInMemoryRepositoryDescriptor() : base()
|
||||||
{
|
{
|
||||||
@@ -224,7 +280,35 @@ namespace xDataService.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// a Repository Descriptor ...
|
/// a Repository Descriptor ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XMongoRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation> : XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>
|
public class XMongoRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema,
|
||||||
|
TRepositoryService,
|
||||||
|
TRepositoryImplementation
|
||||||
|
> : XRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema
|
||||||
|
>
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
where TGraphKey : IGraphType
|
where TGraphKey : IGraphType
|
||||||
where TEntity : XBaseEntity<TKey>
|
where TEntity : XBaseEntity<TKey>
|
||||||
@@ -236,9 +320,8 @@ namespace xDataService.Models
|
|||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TRepositoryImplementation : XBaseMongoRepository<TEntity, TKey>
|
where TRepositoryImplementation : XBaseMongoRepository<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
public XMongoRepositoryDescriptor() : base()
|
public XMongoRepositoryDescriptor() : base()
|
||||||
{
|
{
|
||||||
@@ -251,7 +334,36 @@ namespace xDataService.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// a Repository Descriptor ...
|
/// a Repository Descriptor ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XEFRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema, TRepositoryService, TRepositoryImplementation, TContext> : XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema>
|
public class XEFRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema,
|
||||||
|
TRepositoryService,
|
||||||
|
TRepositoryImplementation,
|
||||||
|
TContext
|
||||||
|
> : XRepositoryDescriptor<
|
||||||
|
TEntity,
|
||||||
|
TKey,
|
||||||
|
TKeyGeneratorService,
|
||||||
|
TKeyGeneratorImplementation,
|
||||||
|
TEventsService,
|
||||||
|
TEventsImplementation,
|
||||||
|
TGraph,
|
||||||
|
TGraphKey,
|
||||||
|
TGraphQuery,
|
||||||
|
TGraphTypeHelperService,
|
||||||
|
TGraphTypeHelperImplementation,
|
||||||
|
TGraphSchema
|
||||||
|
>
|
||||||
where TGraphSchema : Schema
|
where TGraphSchema : Schema
|
||||||
where TContext : XDbContext
|
where TContext : XDbContext
|
||||||
where TGraphKey : IGraphType
|
where TGraphKey : IGraphType
|
||||||
@@ -263,10 +375,9 @@ namespace xDataService.Models
|
|||||||
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
||||||
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
||||||
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
|
where TGraphQuery : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
||||||
where TRepositoryImplementation : XBaseEFRepository<TEntity, TKey, TContext>
|
where TRepositoryImplementation : XBaseEFRepository<TEntity, TKey, TContext>
|
||||||
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
||||||
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
||||||
{
|
{
|
||||||
public XEFRepositoryDescriptor() : base()
|
public XEFRepositoryDescriptor() : base()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using xCommons.Extensions;
|
||||||
|
using xDataService.Extensions;
|
||||||
|
using xDataService.Interfaces;
|
||||||
|
using xModels.Base;
|
||||||
|
|
||||||
|
namespace xDataService.Providers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Default Long Key Generator ...
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||||
|
public class XLongKeyGenerator<TEntity> : XKeyGenerator<TEntity, long>, IXKeyGenerator<TEntity, long>
|
||||||
|
where TEntity : XBaseEntity<long>
|
||||||
|
{
|
||||||
|
public override async Task<long> GenerateKey(
|
||||||
|
IXBaseRepository<TEntity, long> repository,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var items = (await repository.GetAllAsync())
|
||||||
|
.OrderByDescending(nameof(XBaseEntity<long>.Id));
|
||||||
|
var last = items
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = last.IsNull() ? 1 : last.Id + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsEmpty(long id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = id <= 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user