add support for Db Seeder, Fix GraphQL Generic Usage ...
This commit is contained in:
@@ -1,19 +1,25 @@
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Configuration;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xDataService.Interfaces {
|
||||
namespace xDataService.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Db Seeder used to seed data on Database on startup time ...
|
||||
/// </summary>
|
||||
public interface IXDbSeeder {
|
||||
IXDbSeederConfig Config { get; }
|
||||
public interface IXBaseDbSeeder<TEntity, TKey>
|
||||
where TEntity : XBaseEntity<TKey>
|
||||
{
|
||||
string Database { get; }
|
||||
|
||||
IXBaseRepository<TEntity, TKey> Repository { get; }
|
||||
|
||||
XDataServiceConfiguration DataServiceConfiguration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// do all seeding action by helping of Repositories here ...
|
||||
/// don't forget to check UpdateExists value on IXDbSeederConfig for prevent system of duplicate Entity adding on startups ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task Seed ();
|
||||
Task Seed();
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using MongoDB.Bson.Serialization.Conventions;
|
||||
using xDataService.Constants;
|
||||
|
||||
namespace xDataService.Interfaces {
|
||||
public interface IXDataServiceHelper {
|
||||
/// <summary>
|
||||
/// register DbContext implementation on DI Container ...
|
||||
/// Only Used in EFCore ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="connectionString"></param>
|
||||
/// <param name="dbProvider"></param>
|
||||
/// <param name="lifetime"></param>
|
||||
/// <param name="optionsBuilder"></param>
|
||||
void AddDbContext (
|
||||
IServiceCollection services,
|
||||
string connectionString,
|
||||
XDbProviders dbProvider,
|
||||
ServiceLifetime lifetime,
|
||||
Action<dynamic> optionsBuilder = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// register all Entities Repositories and Events on DI Container ...
|
||||
/// implementations of IXBaseRepository and IXBaseRepositoryEvent ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="lifetime"></param>
|
||||
void AddRepositories (
|
||||
IServiceCollection services,
|
||||
ServiceLifetime lifetime
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Regitster KeyGenerators for Repositories ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
void AddKeyGenerators (IServiceCollection services);
|
||||
|
||||
/// <summary>
|
||||
/// register DBSeeder Configuration on DI Container ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="configuration"></param>
|
||||
void AddDbSeederConfiguration (
|
||||
IServiceCollection services,
|
||||
IConfiguration configuration
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// register Data Seeder on DI Container ...
|
||||
/// implementation of IXDbSeeder ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="lifetime"></param>
|
||||
/// <typeparam name="TDbSeeder"></typeparam>
|
||||
void AddDbSeeder<TDbSeeder> (
|
||||
IServiceCollection services,
|
||||
IConfiguration config,
|
||||
ServiceLifetime lifetime
|
||||
) where TDbSeeder : IXDbSeeder;
|
||||
|
||||
/// <summary>
|
||||
/// Set Mongo Convention Pack ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
ConventionPack MongoConventionPacks ();
|
||||
|
||||
/// <summary>
|
||||
/// Configure all required MongoDb Class Mappers and etc here ...
|
||||
/// </summary>
|
||||
void RegisterMongoExtras ();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace xDataService.Interfaces {
|
||||
/// <summary>
|
||||
/// this Configuration used to Carry all Entity Descriptors collections
|
||||
/// can readable by appSettings.json file for providing dynamic data seeding ...
|
||||
/// </summary>
|
||||
public interface IXDbSeederConfig {
|
||||
/// <summary>
|
||||
/// determines an Entity can Update when Exists or not ...
|
||||
/// this must handled by consumer on IXDbSeeder Seed method implementation ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
bool UpdateExists { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using GraphQL.Server;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace xDataService.Interfaces {
|
||||
/// <summary>
|
||||
/// this is a helper class which provides all requirements to providing GraphQL
|
||||
/// based data manipulating mechanism ...
|
||||
/// </summary>
|
||||
public interface IXGraphQLHelper {
|
||||
/// <summary>
|
||||
/// Register all GraphQL Enum Types ...
|
||||
/// Enum Types use to Map string values to Enum values in propper way and vise versa in GraphQL ...
|
||||
/// must extended from EnumerationGraphType ...
|
||||
/// </summary>
|
||||
void AddXGraphEnumTypes (IServiceCollection services);
|
||||
|
||||
/// <summary>
|
||||
/// Register all GraphQL Object Types ...
|
||||
/// GraphQL works based on Types, so for representing each data you have to define a Type ...
|
||||
/// must extended from ObjectGraphType<T> or XBaseGraphObjectType<TKey>
|
||||
/// </summary>
|
||||
void AddXGraphObjectTypes (IServiceCollection services);
|
||||
|
||||
/// <summary>
|
||||
/// Register all GraphQL Input Types ...
|
||||
/// InputTypes represent recieving data structure in GraphQL for doing mutations ...
|
||||
/// must extended from InputObjectGraphType<T> ...
|
||||
/// </summary>
|
||||
void AddXGraphInputTypes (IServiceCollection services);
|
||||
|
||||
/// <summary>
|
||||
/// Register all GraphQL Queries ...
|
||||
/// Queries in GraphQL used to provide data fetch and retrieve mechanism ...
|
||||
/// extended from ObjectGraphType ...
|
||||
/// </summary>
|
||||
void AddXGraphQueries (IServiceCollection services);
|
||||
|
||||
/// <summary>
|
||||
/// Register all GraphQL Mutations ...
|
||||
/// Mutations is an Action types in GraphQL which data changed through them, like as Add, Update, Delete ...
|
||||
/// must extends from ObjectGraphType ...
|
||||
/// </summary>
|
||||
void AddXGraphMutations (IServiceCollection services);
|
||||
|
||||
/// <summary>
|
||||
/// Register all GraphQL Subscriptions ...
|
||||
/// Subscriptions are listeners to specific events on data in GraphQL ...
|
||||
/// must extended from ObjectGraphType and implements IXBaseRepositoryEvents<TEntity> ...
|
||||
/// </summary>
|
||||
void AddXGraphSubscriptions (IServiceCollection services);
|
||||
|
||||
/// <summary>
|
||||
/// Register all GraphQL Schemas ...
|
||||
/// each available Entity in Database must described to GraphQL with all Graph based stuffs such as :
|
||||
/// Queries, Types and etc, this must done through an Schema class.
|
||||
/// must extended from Schema ...
|
||||
/// </summary>
|
||||
void AddXGraphSchemas (IServiceCollection services);
|
||||
|
||||
/// <summary>
|
||||
/// Add Schemas to GraphQL Builder ...
|
||||
/// here you must add all registered Schemas to GraphQLBuilder ...
|
||||
/// </summary>
|
||||
/// <param name="builder"></param>
|
||||
/// <returns></returns>
|
||||
IGraphQLBuilder AddXGraphTypes (IGraphQLBuilder builder);
|
||||
|
||||
/// <summary>
|
||||
/// Use all Registered Schemas by GraphQL<T> and and GraphQLWebSockets<T> ...
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
void UseXGraph (IApplicationBuilder app);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user