279 lines
12 KiB
C#
279 lines
12 KiB
C#
using System;
|
|
using GraphQL.Types;
|
|
using xDataService.Db;
|
|
using xDataService.EFRepositories;
|
|
using xDataService.Events;
|
|
using xDataService.GraphQL;
|
|
using xDataService.InMemRepositories;
|
|
using xDataService.Interfaces;
|
|
using xDataService.MongoRepositories;
|
|
using xDataService.Providers;
|
|
using xModels.Base;
|
|
|
|
namespace xDataService.Models
|
|
{
|
|
/// <summary>
|
|
/// a Global non Generic Repository Descriptor ...
|
|
/// </summary>
|
|
public class XRepositoryDescriptor
|
|
{
|
|
/// <summary>
|
|
/// Entity Key Type ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type Key { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Entity Type ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type Entity { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Context Type ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type Context { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Graph Type Key ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type GraphTypeKey { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Graph Type ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type GraphType { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Entity Type GraphQL Schema ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type GraphSchema { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Entity GraphQL Type Helper ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type GraphTypeHelperService { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Entity GraphQL Type Helper ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type GraphTypeHelperImplementation { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Entity GrapQL Query ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type GraphQueryService { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Entity GrapQL Query ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type GraphQueryImplementation { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Repository Event Provider ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type EventsService { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Repository Event Provider ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type EventsImplementation { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Repository Key Generator for Entity ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type KeyGeneratorService { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Repository Key Generator for Entity ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type KeyGeneratorImplementation { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Repository Data Access Design Pattern ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type RepositoryService { get; set; }
|
|
|
|
/// <summary>
|
|
/// Repository Data Access Design Pattern ...
|
|
/// </summary>
|
|
/// <value></value>
|
|
public Type RepositoryImplementation { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// a Repository Descriptor ...
|
|
/// </summary>
|
|
/// <typeparam name="TEntity"></typeparam>
|
|
/// <typeparam name="TKey"></typeparam>
|
|
public class XRepositoryDescriptor<TEntity, TKey> : XRepositoryDescriptor
|
|
where TEntity : XBaseEntity<TKey>
|
|
{
|
|
public XRepositoryDescriptor() : base()
|
|
{
|
|
//
|
|
Key = typeof(TKey);
|
|
Entity = typeof(TEntity);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// a Repository Descriptor ...
|
|
/// </summary>
|
|
public class XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation> : XRepositoryDescriptor<TEntity, TKey>
|
|
where TEntity : XBaseEntity<TKey>
|
|
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
|
{
|
|
public XRepositoryDescriptor() : base()
|
|
{
|
|
//
|
|
KeyGeneratorService = typeof(TKeyGeneratorService);
|
|
KeyGeneratorImplementation = typeof(TKeyGeneratorImplementation);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// a Repository Descriptor ...
|
|
/// </summary>
|
|
public class XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation> : XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation>
|
|
where TEntity : XBaseEntity<TKey>
|
|
where TEventsService : IXBaseRepositoryEvents<TEntity>
|
|
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
|
{
|
|
public XRepositoryDescriptor() : base()
|
|
{
|
|
//
|
|
EventsService = typeof(TEventsService);
|
|
EventsImplementation = typeof(TEventsImplementation);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// a Repository Descriptor ...
|
|
/// </summary>
|
|
public class XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation, TGraph, TGraphKey, TGraphQueryService, TGraphQueryImplementation, TGraphTypeHelperService, TGraphTypeHelperImplementation, TGraphSchema> : XRepositoryDescriptor<TEntity, TKey, TKeyGeneratorService, TKeyGeneratorImplementation, TEventsService, TEventsImplementation>
|
|
where TGraphSchema : Schema
|
|
where TGraphKey : IGraphType
|
|
where TEntity : XBaseEntity<TKey>
|
|
where TGraph : XBaseGraphObjectType<TEntity, TKey>
|
|
where TEventsService : IXBaseRepositoryEvents<TEntity>
|
|
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
|
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
{
|
|
public XRepositoryDescriptor() : base()
|
|
{
|
|
//
|
|
GraphType = typeof(TGraph);
|
|
GraphTypeKey = typeof(TGraphKey);
|
|
GraphSchema = typeof(TGraphSchema);
|
|
GraphQueryService = typeof(TGraphQueryService);
|
|
GraphTypeHelperService = typeof(TGraphTypeHelperService);
|
|
GraphQueryImplementation = typeof(TGraphQueryImplementation);
|
|
GraphTypeHelperImplementation = typeof(TGraphTypeHelperImplementation);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// a Repository Descriptor ...
|
|
/// </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>
|
|
where TGraphSchema : Schema
|
|
where TGraphKey : IGraphType
|
|
where TEntity : XBaseEntity<TKey>
|
|
where TGraph : XBaseGraphObjectType<TEntity, TKey>
|
|
where TEventsService : IXBaseRepositoryEvents<TEntity>
|
|
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
|
where TRepositoryService : IXBaseRepository<TEntity, TKey>
|
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
|
where TRepositoryImplementation : XBaseInMemoryRepositoy<TEntity, TKey>
|
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
|
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
{
|
|
public XInMemoryRepositoryDescriptor() : base()
|
|
{
|
|
//
|
|
RepositoryService = typeof(TRepositoryService);
|
|
RepositoryImplementation = typeof(TRepositoryImplementation);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// a Repository Descriptor ...
|
|
/// </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>
|
|
where TGraphSchema : Schema
|
|
where TGraphKey : IGraphType
|
|
where TEntity : XBaseEntity<TKey>
|
|
where TGraph : XBaseGraphObjectType<TEntity, TKey>
|
|
where TEventsService : IXBaseRepositoryEvents<TEntity>
|
|
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
|
where TRepositoryService : IXBaseRepository<TEntity, TKey>
|
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
|
where TRepositoryImplementation : XBaseMongoRepository<TEntity, TKey>
|
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
|
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
{
|
|
public XMongoRepositoryDescriptor() : base()
|
|
{
|
|
//
|
|
RepositoryService = typeof(TRepositoryService);
|
|
RepositoryImplementation = typeof(TRepositoryImplementation);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// a Repository Descriptor ...
|
|
/// </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>
|
|
where TGraphSchema : Schema
|
|
where TContext : XDbContext
|
|
where TGraphKey : IGraphType
|
|
where TEntity : XBaseEntity<TKey>
|
|
where TGraph : XBaseGraphObjectType<TEntity, TKey>
|
|
where TEventsService : IXBaseRepositoryEvents<TEntity>
|
|
where TKeyGeneratorService : IXKeyGenerator<TEntity, TKey>
|
|
where TRepositoryService : IXBaseRepository<TEntity, TKey>
|
|
where TEventsImplementation : XBaseRepositoryEvents<TEntity>
|
|
where TKeyGeneratorImplementation : XKeyGenerator<TEntity, TKey>
|
|
where TGraphTypeHelperService : IXBaseGraphQLTypeHelper<TEntity, TKey>
|
|
where TRepositoryImplementation : XBaseEFRepository<TEntity, TKey, TContext>
|
|
where TGraphTypeHelperImplementation : XBaseGraphQLTypeHelper<TEntity, TKey>
|
|
where TGraphQueryService : IXBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
where TGraphQueryImplementation : XBaseGraphQLQuery<TEntity, TKey, TGraph, TGraphKey>
|
|
{
|
|
public XEFRepositoryDescriptor() : base()
|
|
{
|
|
//
|
|
Context = typeof(TContext);
|
|
RepositoryService = typeof(TRepositoryService);
|
|
RepositoryImplementation = typeof(TRepositoryImplementation);
|
|
}
|
|
}
|
|
} |