278 lines
8.6 KiB
C#
278 lines
8.6 KiB
C#
using GraphQL.Types;
|
|
using xDataService.Db;
|
|
using xDataService.Models;
|
|
using xDataService.Providers;
|
|
using xBotService.Models.Entities;
|
|
using xBotService.Providers.GraphQL;
|
|
using xBotService.Providers.Entities;
|
|
using xBotService.Interfaces.Entities;
|
|
|
|
namespace XBotUserService.Helpers
|
|
{
|
|
public static class XBotServiceHelper
|
|
{
|
|
//
|
|
#region EF Repository Descriptor Provider(s) ...
|
|
public static XEFRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserEFRepository<TContext>,
|
|
TContext
|
|
> GetXBotUserEFRepositoryDescriptor<TContext>()
|
|
where TContext : XDbContext
|
|
{
|
|
//
|
|
var result = new XEFRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserEFRepository<TContext>,
|
|
TContext
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XEFRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserEFRepository<TContext>,
|
|
TContext,
|
|
IXBotUserSeeder,
|
|
TSeederImplementation
|
|
> GetXBotUserEFRepositoryDescriptor<TContext, TSeederImplementation>()
|
|
where TContext : XDbContext
|
|
where TSeederImplementation : XBaseDbSeeder<XBotUser, int>
|
|
{
|
|
//
|
|
var result = new XEFRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserEFRepository<TContext>,
|
|
TContext,
|
|
IXBotUserSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
#region Mongo Repository Descriptor Provider(s) ...
|
|
public static XMongoRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserMongoRepository
|
|
> GetXBotUserMongoRepositoryDescriptor()
|
|
{
|
|
//
|
|
var result = new XMongoRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserMongoRepository
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XMongoRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserMongoRepository,
|
|
IXBotUserSeeder,
|
|
TSeederImplementation
|
|
> GetXBotUserMongoRepositoryDescriptor<TSeederImplementation>()
|
|
where TSeederImplementation : XBaseDbSeeder<XBotUser, int>
|
|
{
|
|
//
|
|
var result = new XMongoRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserMongoRepository,
|
|
IXBotUserSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
#region InMemory Repository Descriptor Provider(s) ...
|
|
public static XInMemoryRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserInMemoryRepository
|
|
> GetXBotUserInMemoryRepositoryDescriptor()
|
|
{
|
|
//
|
|
var result = new XInMemoryRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserInMemoryRepository
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XInMemoryRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserInMemoryRepository,
|
|
IXBotUserSeeder,
|
|
TSeederImplementation
|
|
> GetXBotUserInMemoryRepositoryDescriptor<TSeederImplementation>()
|
|
where TSeederImplementation : XBaseDbSeeder<XBotUser, int>
|
|
{
|
|
//
|
|
var result = new XInMemoryRepositoryDescriptor<
|
|
XBotUser,
|
|
int,
|
|
IXBotUserKeyGenerator,
|
|
XBotUserKeyGenerator,
|
|
IXBotUserRepositoryEvents,
|
|
XBotUserRepositoryEvents,
|
|
XBotUserGraphType,
|
|
IntGraphType,
|
|
XBotUserGraphQuery,
|
|
IXBotUserGraphQLTypeHelper,
|
|
XBotUserGraphQLTypeHelper,
|
|
XBotUserGraphSchema,
|
|
IXBotUserRepository,
|
|
XBotUserInMemoryRepository,
|
|
IXBotUserSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
}
|
|
} |