550 lines
19 KiB
C#
550 lines
19 KiB
C#
using System;
|
|
using GraphQL.Types;
|
|
using xDataService.Db;
|
|
using xDataService.Models;
|
|
using xDataService.Providers;
|
|
using xWebinarService.Interfaces;
|
|
using xWebinarService.Interfaces.Entities;
|
|
using xWebinarService.Models.Entities;
|
|
using xWebinarService.Providers.Entities;
|
|
using xWebinarService.Providers.GraphQL;
|
|
|
|
namespace xWebinarService.Helpers
|
|
{
|
|
public static class XWebinarServiceHelper
|
|
{
|
|
//
|
|
#region XWebinar ...
|
|
//
|
|
#region EF Repository Descriptor Provider(s) ...
|
|
public static XEFRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarEFRepository<TContext>,
|
|
TContext
|
|
> GetXWebinarEFRepositoryDescriptor<TContext>()
|
|
where TContext : XDbContext
|
|
{
|
|
//
|
|
var result = new XEFRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarEFRepository<TContext>,
|
|
TContext
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XEFRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarEFRepository<TContext>,
|
|
TContext,
|
|
IXWebinarSeeder,
|
|
TSeederImplementation
|
|
> GetXWebinarEFRepositoryDescriptor<TContext, TSeederImplementation>()
|
|
where TContext : XDbContext
|
|
where TSeederImplementation : XBaseDbSeeder<XWebinar, Guid>
|
|
{
|
|
//
|
|
var result = new XEFRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarEFRepository<TContext>,
|
|
TContext,
|
|
IXWebinarSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
#region Mongo Repository Descriptor Provider(s) ...
|
|
public static XMongoRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarMongoRepository
|
|
> GetXWebinarMongoRepositoryDescriptor()
|
|
{
|
|
//
|
|
var result = new XMongoRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarMongoRepository
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XMongoRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarMongoRepository,
|
|
IXWebinarSeeder,
|
|
TSeederImplementation
|
|
> GetXWebinarMongoRepositoryDescriptor<TSeederImplementation>()
|
|
where TSeederImplementation : XBaseDbSeeder<XWebinar, Guid>
|
|
{
|
|
//
|
|
var result = new XMongoRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarMongoRepository,
|
|
IXWebinarSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
#region InMemory Repository Descriptor Provider(s) ...
|
|
public static XInMemoryRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarInMemoryRepository
|
|
> GetXWebinarInMemoryRepositoryDescriptor()
|
|
{
|
|
//
|
|
var result = new XInMemoryRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarInMemoryRepository
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XInMemoryRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarInMemoryRepository,
|
|
IXWebinarSeeder,
|
|
TSeederImplementation
|
|
> GetXWebinarInMemoryRepositoryDescriptor<TSeederImplementation>()
|
|
where TSeederImplementation : XBaseDbSeeder<XWebinar, Guid>
|
|
{
|
|
//
|
|
var result = new XInMemoryRepositoryDescriptor<
|
|
XWebinar,
|
|
Guid,
|
|
IXWebinarKeyGenerator,
|
|
XWebinarKeyGenerator,
|
|
IXWebinarRepositoryEvents,
|
|
XWebinarRepositoryEvents,
|
|
XWebinarGraphType,
|
|
GuidGraphType,
|
|
XWebinarGraphQuery,
|
|
IXWebinarGraphQLTypeHelper,
|
|
XWebinarGraphQLTypeHelper,
|
|
XWebinarGraphSchema,
|
|
IXWebinarRepository,
|
|
XWebinarInMemoryRepository,
|
|
IXWebinarSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
//
|
|
#region XWebinarSubscriber ...
|
|
//
|
|
#region EF Repository Descriptor Provider(s) ...
|
|
public static XEFRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberEFRepository<TContext>,
|
|
TContext
|
|
> GetXWebinarSubscriberEFRepositoryDescriptor<TContext>()
|
|
where TContext : XDbContext
|
|
{
|
|
//
|
|
var result = new XEFRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberEFRepository<TContext>,
|
|
TContext
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XEFRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberEFRepository<TContext>,
|
|
TContext,
|
|
IXWebinarSubscriberSeeder,
|
|
TSeederImplementation
|
|
> GetXWebinarSubscriberEFRepositoryDescriptor<TContext, TSeederImplementation>()
|
|
where TContext : XDbContext
|
|
where TSeederImplementation : XBaseDbSeeder<XWebinarSubscriber, int>
|
|
{
|
|
//
|
|
var result = new XEFRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberEFRepository<TContext>,
|
|
TContext,
|
|
IXWebinarSubscriberSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
#region Mongo Repository Descriptor Provider(s) ...
|
|
public static XMongoRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberMongoRepository
|
|
> GetXWebinarSubscriberMongoRepositoryDescriptor()
|
|
{
|
|
//
|
|
var result = new XMongoRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberMongoRepository
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XMongoRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberMongoRepository,
|
|
IXWebinarSubscriberSeeder,
|
|
TSeederImplementation
|
|
> GetXWebinarSubscriberMongoRepositoryDescriptor<TSeederImplementation>()
|
|
where TSeederImplementation : XBaseDbSeeder<XWebinarSubscriber, int>
|
|
{
|
|
//
|
|
var result = new XMongoRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberMongoRepository,
|
|
IXWebinarSubscriberSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
#region InMemory Repository Descriptor Provider(s) ...
|
|
public static XInMemoryRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberInMemoryRepository
|
|
> GetXWebinarSubscriberInMemoryRepositoryDescriptor()
|
|
{
|
|
//
|
|
var result = new XInMemoryRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberInMemoryRepository
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XInMemoryRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberInMemoryRepository,
|
|
IXWebinarSubscriberSeeder,
|
|
TSeederImplementation
|
|
> GetXWebinarSubscriberInMemoryRepositoryDescriptor<TSeederImplementation>()
|
|
where TSeederImplementation : XBaseDbSeeder<XWebinarSubscriber, int>
|
|
{
|
|
//
|
|
var result = new XInMemoryRepositoryDescriptor<
|
|
XWebinarSubscriber,
|
|
int,
|
|
IXWebinarSubscriberKeyGenerator,
|
|
XWebinarSubscriberKeyGenerator,
|
|
IXWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberRepositoryEvents,
|
|
XWebinarSubscriberGraphType,
|
|
IntGraphType,
|
|
XWebinarSubscriberGraphQuery,
|
|
IXWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphQLTypeHelper,
|
|
XWebinarSubscriberGraphSchema,
|
|
IXWebinarSubscriberRepository,
|
|
XWebinarSubscriberInMemoryRepository,
|
|
IXWebinarSubscriberSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
#endregion
|
|
}
|
|
} |