282 lines
8.8 KiB
C#
282 lines
8.8 KiB
C#
using System;
|
|
using GraphQL.Types;
|
|
using xContentService.Interfaces.Entities;
|
|
using xContentService.Models.Entities;
|
|
using xContentService.Providers.Entities;
|
|
using xContentService.Providers.GraphQL;
|
|
using xDataService.Db;
|
|
using xDataService.Models;
|
|
using xDataService.Providers;
|
|
|
|
namespace xContentService.Helpers
|
|
{
|
|
public static class XContentServiceHelper
|
|
{
|
|
//
|
|
#region XContent ...
|
|
//
|
|
#region EF Repository Descriptor Provider(s) ...
|
|
public static XEFRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentEFRepository<TContext>,
|
|
TContext
|
|
> GetXContentEFRepositoryDescriptor<TContext>()
|
|
where TContext : XDbContext
|
|
{
|
|
//
|
|
var result = new XEFRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentEFRepository<TContext>,
|
|
TContext
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XEFRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentEFRepository<TContext>,
|
|
TContext,
|
|
IXContentSeeder,
|
|
TSeederImplementation
|
|
> GetXContentEFRepositoryDescriptor<TContext, TSeederImplementation>()
|
|
where TContext : XDbContext
|
|
where TSeederImplementation : XBaseDbSeeder<XContent, Guid>
|
|
{
|
|
//
|
|
var result = new XEFRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentEFRepository<TContext>,
|
|
TContext,
|
|
IXContentSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
#region Mongo Repository Descriptor Provider(s) ...
|
|
public static XMongoRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentMongoRepository
|
|
> GetXContentMongoRepositoryDescriptor()
|
|
{
|
|
//
|
|
var result = new XMongoRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentMongoRepository
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XMongoRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentMongoRepository,
|
|
IXContentSeeder,
|
|
TSeederImplementation
|
|
> GetXContentMongoRepositoryDescriptor<TSeederImplementation>()
|
|
where TSeederImplementation : XBaseDbSeeder<XContent, Guid>
|
|
{
|
|
//
|
|
var result = new XMongoRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentMongoRepository,
|
|
IXContentSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
#region InMemory Repository Descriptor Provider(s) ...
|
|
public static XInMemoryRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentInMemoryRepository
|
|
> GetXContentInMemoryRepositoryDescriptor()
|
|
{
|
|
//
|
|
var result = new XInMemoryRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentInMemoryRepository
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
public static XInMemoryRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentInMemoryRepository,
|
|
IXContentSeeder,
|
|
TSeederImplementation
|
|
> GetXContentInMemoryRepositoryDescriptor<TSeederImplementation>()
|
|
where TSeederImplementation : XBaseDbSeeder<XContent, Guid>
|
|
{
|
|
//
|
|
var result = new XInMemoryRepositoryDescriptor<
|
|
XContent,
|
|
Guid,
|
|
IXContentKeyGenerator,
|
|
XContentKeyGenerator,
|
|
IXContentRepositoryEvents,
|
|
XContentRepositoryEvents,
|
|
XContentGraphType,
|
|
GuidGraphType,
|
|
XContentGraphQuery,
|
|
IXContentGraphQLTypeHelper,
|
|
XContentGraphQLTypeHelper,
|
|
XContentGraphSchema,
|
|
IXContentRepository,
|
|
XContentInMemoryRepository,
|
|
IXContentSeeder,
|
|
TSeederImplementation
|
|
>();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
#endregion
|
|
#endregion
|
|
}
|
|
} |