last ...
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xCategoryService.Configurations.Entities
|
||||
{
|
||||
public class XCategoryEntityConfiguration : XBaseEntityTypeConfiguration<XCategory, int>
|
||||
{
|
||||
public override void Configure(EntityTypeBuilder<XCategory> builder)
|
||||
{
|
||||
builder.ToTable("Categories");
|
||||
}
|
||||
}
|
||||
}
|
||||
+108
-26
@@ -2,8 +2,10 @@ using System;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using xCategoryService.Helpers;
|
||||
using xCategoryService.Interfaces;
|
||||
using xCategoryService.Interfaces.Dtos;
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Providers;
|
||||
using xCategoryService.Providers.Dtos;
|
||||
using xCategoryService.Providers.Entities;
|
||||
using xCommons.Extensions;
|
||||
@@ -73,25 +75,42 @@ namespace xCategoryService.DI
|
||||
)
|
||||
{
|
||||
//
|
||||
#region Using XSubCategory Hubs ...
|
||||
#region Using Hubs ...
|
||||
//
|
||||
var pushHelper = new XPushServiceHelper();
|
||||
|
||||
//
|
||||
pushHelper.AddHub<XSubCategoryDtoHub>("tagDto");
|
||||
pushHelper.AddHub<XSubCategoryEntityHub>("tagEntity");
|
||||
// Category ...
|
||||
pushHelper.AddHub<XCategoryDtoHub>("categoryDto");
|
||||
pushHelper.AddHub<XCategoryEntityHub>("categoryEntity");
|
||||
|
||||
//
|
||||
// SubCategory ...
|
||||
pushHelper.AddHub<XSubCategoryDtoHub>("subCategoryDto");
|
||||
pushHelper.AddHub<XSubCategoryEntityHub>("subCategoryEntity");
|
||||
|
||||
//
|
||||
app.UseXPushService(pushHelper);
|
||||
#endregion
|
||||
|
||||
//
|
||||
// Using XSubCategory Repository Descriptor ...
|
||||
if (!subCategoryescriptor.IsNull())
|
||||
// Using XCategory Repository Descriptor ...
|
||||
if (!categoryDescriptor.IsNull())
|
||||
{
|
||||
//
|
||||
app.UseXRepository(
|
||||
descriptor: subCategoryescriptor,
|
||||
descriptor: categoryDescriptor,
|
||||
isDevelopmentEnvironment: isDevelopmentEnvironment
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Using XSubCategory Repository Descriptor ...
|
||||
if (!subCategoryDescriptor.IsNull())
|
||||
{
|
||||
//
|
||||
app.UseXRepository(
|
||||
descriptor: subCategoryDescriptor,
|
||||
isDevelopmentEnvironment: isDevelopmentEnvironment
|
||||
);
|
||||
}
|
||||
@@ -100,7 +119,7 @@ namespace xCategoryService.DI
|
||||
//
|
||||
#region Private ...
|
||||
private static XRepositoryDescriptor categoryDescriptor = null;
|
||||
private static XRepositoryDescriptor subCategoryescriptor = null;
|
||||
private static XRepositoryDescriptor subCategoryDescriptor = null;
|
||||
|
||||
/// <summary>
|
||||
/// a LogTag for Service ...
|
||||
@@ -176,7 +195,17 @@ namespace xCategoryService.DI
|
||||
//
|
||||
case XRepositoryType.EF:
|
||||
//
|
||||
subCategoryescriptor = typeof(XCategoryServiceHelper)
|
||||
// Category ...
|
||||
categoryDescriptor = typeof(XCategoryServiceHelper)
|
||||
.InvokeGenericMethod<XRepositoryDescriptor>(
|
||||
methodName: "GetXCategoryEFRepositoryDescriptor",
|
||||
runtimeType: contextType,
|
||||
args: null
|
||||
);
|
||||
|
||||
//
|
||||
// SubCategory ...
|
||||
subCategoryDescriptor = typeof(XCategoryServiceHelper)
|
||||
.InvokeGenericMethod<XRepositoryDescriptor>(
|
||||
methodName: "GetXSubCategoryEFRepositoryDescriptor",
|
||||
runtimeType: contextType,
|
||||
@@ -186,39 +215,92 @@ namespace xCategoryService.DI
|
||||
|
||||
//
|
||||
case XRepositoryType.Mongo:
|
||||
subCategoryescriptor = XCategoryServiceHelper.GetXSubCategoryMongoRepositoryDescriptor();
|
||||
//
|
||||
// Category ...
|
||||
categoryDescriptor = XCategoryServiceHelper.GetXCategoryMongoRepositoryDescriptor();
|
||||
|
||||
//
|
||||
// SubCategory ...
|
||||
subCategoryDescriptor = XCategoryServiceHelper.GetXSubCategoryMongoRepositoryDescriptor();
|
||||
break;
|
||||
|
||||
//
|
||||
case XRepositoryType.InMemory:
|
||||
subCategoryescriptor = XCategoryServiceHelper.GetXSubCategoryInMemoryRepositoryDescriptor();
|
||||
//
|
||||
// Category ...
|
||||
categoryDescriptor = XCategoryServiceHelper.GetXCategoryInMemoryRepositoryDescriptor();
|
||||
|
||||
//
|
||||
// SubCategory ...
|
||||
subCategoryDescriptor = XCategoryServiceHelper.GetXSubCategoryInMemoryRepositoryDescriptor();
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Register XSubCategory Repository Descriptor ...
|
||||
// Register Category Repository Descriptor ...
|
||||
services.AddXRepository(
|
||||
lifeTime: lifeTime,
|
||||
descriptor: subCategoryescriptor
|
||||
descriptor: categoryDescriptor
|
||||
);
|
||||
|
||||
//
|
||||
// Register Dto Services ...
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXSubCategoryServiceProvider), typeof(XSubCategoryServiceProvider), lifeTime)
|
||||
);
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXSubCategoryRepositoryService), typeof(XSubCategoryRepositoryService), lifeTime)
|
||||
);
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXSubCategoryRepositoryProvider), typeof(XSubCategoryRepositoryProvider), lifeTime)
|
||||
);
|
||||
|
||||
//
|
||||
// services.Add(
|
||||
// new ServiceDescriptor(typeof(IXSubCategoryProvider), typeof(XSubCategoryProvider), lifeTime)
|
||||
// Register SubCategory Repository Descriptor ...
|
||||
// services.AddXRepository(
|
||||
// lifeTime: lifeTime,
|
||||
// descriptor: subCategoryDescriptor
|
||||
// );
|
||||
|
||||
//
|
||||
#region Register Services ...
|
||||
//
|
||||
#region Category ...
|
||||
//
|
||||
// Models ...
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXCategoryServiceProvider), typeof(XCategoryServiceProvider), lifeTime)
|
||||
);
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXCategoryRepositoryService), typeof(XCategoryRepositoryService), lifeTime)
|
||||
);
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXCategoryRepositoryProvider), typeof(XCategoryRepositoryProvider), lifeTime)
|
||||
);
|
||||
|
||||
//
|
||||
// Resource Providers ...
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXCategoryTitleResourceProvider), typeof(XCategoryTitleResourceProvider), lifeTime)
|
||||
);
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXCategoryDescriptionResourceProvider), typeof(XCategoryDescriptionResourceProvider), lifeTime)
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region SubCategory ...
|
||||
//
|
||||
// Models ...
|
||||
// services.Add(
|
||||
// new ServiceDescriptor(typeof(IXSubCategoryServiceProvider), typeof(XSubCategoryServiceProvider), lifeTime)
|
||||
// );
|
||||
// services.Add(
|
||||
// new ServiceDescriptor(typeof(IXSubCategoryRepositoryService), typeof(XSubCategoryRepositoryService), lifeTime)
|
||||
// );
|
||||
// services.Add(
|
||||
// new ServiceDescriptor(typeof(IXSubCategoryRepositoryProvider), typeof(XSubCategoryRepositoryProvider), lifeTime)
|
||||
// );
|
||||
|
||||
// //
|
||||
// // Resource Providers ...
|
||||
// services.Add(
|
||||
// new ServiceDescriptor(typeof(IXSubCategoryTitleResourceProvider), typeof(XSubCategoryTitleResourceProvider), lifeTime)
|
||||
// );
|
||||
// services.Add(
|
||||
// new ServiceDescriptor(typeof(IXSubCategoryDescriptionResourceProvider), typeof(XSubCategoryDescriptionResourceProvider), lifeTime)
|
||||
// );
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
//
|
||||
Log("Service Regitration Succeed ...");
|
||||
}
|
||||
|
||||
@@ -14,6 +14,100 @@ namespace xCategoryService.Helpers
|
||||
{
|
||||
//
|
||||
#region EF Repository Descriptor Provider(s) ...
|
||||
//
|
||||
#region Category
|
||||
public static XEFRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryEFRepository<TContext>,
|
||||
TContext
|
||||
> GetXCategoryEFRepositoryDescriptor<TContext>()
|
||||
where TContext : XDbContext
|
||||
{
|
||||
//
|
||||
var result = new XEFRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryEFRepository<TContext>,
|
||||
TContext
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public static XEFRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryEFRepository<TContext>,
|
||||
TContext,
|
||||
IXCategorySeeder,
|
||||
TSeederImplementation
|
||||
> GetXCategoryEFRepositoryDescriptor<TContext, TSeederImplementation>()
|
||||
where TContext : XDbContext
|
||||
where TSeederImplementation : XBaseDbSeeder<XCategory, int>
|
||||
{
|
||||
//
|
||||
var result = new XEFRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryEFRepository<TContext>,
|
||||
TContext,
|
||||
IXCategorySeeder,
|
||||
TSeederImplementation
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region SubCategory
|
||||
public static XEFRepositoryDescriptor<
|
||||
XSubCategory,
|
||||
int,
|
||||
@@ -103,9 +197,98 @@ namespace xCategoryService.Helpers
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Mongo Repository Descriptor Provider(s) ...
|
||||
//
|
||||
#region Category
|
||||
public static XMongoRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryMongoRepository
|
||||
> GetXCategoryMongoRepositoryDescriptor()
|
||||
{
|
||||
//
|
||||
var result = new XMongoRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryMongoRepository
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public static XMongoRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryMongoRepository,
|
||||
IXCategorySeeder,
|
||||
TSeederImplementation
|
||||
> GetXCategoryMongoRepositoryDescriptor<TSeederImplementation>()
|
||||
where TSeederImplementation : XBaseDbSeeder<XCategory, int>
|
||||
{
|
||||
//
|
||||
var result = new XMongoRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryMongoRepository,
|
||||
IXCategorySeeder,
|
||||
TSeederImplementation
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region SubCategory
|
||||
public static XMongoRepositoryDescriptor<
|
||||
XSubCategory,
|
||||
int,
|
||||
@@ -189,9 +372,98 @@ namespace xCategoryService.Helpers
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region InMemory Repository Descriptor Provider(s) ...
|
||||
//
|
||||
#region Category
|
||||
public static XInMemoryRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryInMemoryRepository
|
||||
> GetXCategoryInMemoryRepositoryDescriptor()
|
||||
{
|
||||
//
|
||||
var result = new XInMemoryRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryInMemoryRepository
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public static XInMemoryRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryInMemoryRepository,
|
||||
IXCategorySeeder,
|
||||
TSeederImplementation
|
||||
> GetXCategoryInMemoryRepositoryDescriptor<TSeederImplementation>()
|
||||
where TSeederImplementation : XBaseDbSeeder<XCategory, int>
|
||||
{
|
||||
//
|
||||
var result = new XInMemoryRepositoryDescriptor<
|
||||
XCategory,
|
||||
int,
|
||||
IXCategoryKeyGenerator,
|
||||
XCategoryKeyGenerator,
|
||||
IXCategoryRepositoryEvents,
|
||||
XCategoryRepositoryEvents,
|
||||
XCategoryGraphType,
|
||||
IntGraphType,
|
||||
XCategoryGraphQuery,
|
||||
IXCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphQLTypeHelper,
|
||||
XCategoryGraphSchema,
|
||||
IXCategoryRepository,
|
||||
XCategoryInMemoryRepository,
|
||||
IXCategorySeeder,
|
||||
TSeederImplementation
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region SubCategory
|
||||
public static XInMemoryRepositoryDescriptor<
|
||||
XSubCategory,
|
||||
int,
|
||||
@@ -274,6 +546,7 @@ namespace xCategoryService.Helpers
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xCategoryService.Models.Dtos;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces.Dtos
|
||||
{
|
||||
public interface IXCategoryDtoHub : IXBaseDtoHub<XCategory, XCategoryDto, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xCategoryService.Models.Dtos;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces.Dtos
|
||||
{
|
||||
public interface IXCategoryRepositoryService : IXBaseRepositoryService<XCategory, XCategoryDto, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using xCategoryService.Models.Dtos;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xCategoryService.Providers.Dtos;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces.Dtos
|
||||
{
|
||||
public interface IXCategoryServiceProvider : IXBaseDtoProvider<XCategory, XCategoryDto, int, XCategoryDtoHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xCategoryService.Models.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces.Entities
|
||||
{
|
||||
public interface IXCategoryEntityHub : IXBaseEntityHub<XCategory, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces.Entities
|
||||
{
|
||||
public interface IXCategoryGraphQLTypeHelper : IXBaseGraphQLTypeHelper<XCategory, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces.Entities
|
||||
{
|
||||
public interface IXCategoryKeyGenerator : IXKeyGenerator<XCategory, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces.Entities
|
||||
{
|
||||
public interface IXCategoryRepository : IXBaseRepository<XCategory, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces.Entities
|
||||
{
|
||||
public interface IXCategoryRepositoryEvents : IXBaseRepositoryEvents<XCategory>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xCategoryService.Models.Entities;
|
||||
using xCategoryService.Providers.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces.Entities
|
||||
{
|
||||
public interface IXCategoryRepositoryProvider : IXBaseEntityProvider<XCategory, int, XCategoryEntityHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using xStringService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces
|
||||
{
|
||||
public interface IXCategoryDescriptionResourceProvider : IXItemResourceProvider
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces
|
||||
{
|
||||
public interface IXCategorySeeder : IXBaseDbSeeder<XCategory, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using xStringService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Interfaces
|
||||
{
|
||||
public interface IXCategoryTitleResourceProvider : IXItemResourceProvider
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using xModels.Base;
|
||||
|
||||
namespace xCategoryService.Models.Dtos
|
||||
{
|
||||
public class XCategoryDto : XBaseIntIDEntityDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Title of SubCategory ...
|
||||
/// this is a Resource Title ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description of SubCategory ...
|
||||
/// this is a Resource Title ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// References List String Representation ...
|
||||
/// each SubCategory Referenced to Category ID which List here ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string References { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using xModels.Base;
|
||||
|
||||
namespace xCategoryService.Models.Entities
|
||||
{
|
||||
public class XCategory : XBaseIntIDEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Title of SubCategory ...
|
||||
/// this is a Resource Title ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description of SubCategory ...
|
||||
/// this is a Resource Title ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// References List String Representation ...
|
||||
/// each SubCategory Referenced to Category ID which List here ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string References { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCategoryService.Interfaces.Dtos;
|
||||
using xCategoryService.Models.Dtos;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xPushService.Base;
|
||||
|
||||
namespace xCategoryService.Providers.Dtos
|
||||
{
|
||||
public class XCategoryDtoHub : XBaseDtoHub<XCategory, XCategoryDto, int>, IXCategoryDtoHub
|
||||
{
|
||||
public XCategoryDtoHub(
|
||||
ILogger<XCategoryDtoHub> logger
|
||||
) : base(logger)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using xCategoryService.Interfaces.Dtos;
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Dtos;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xCategoryService.Providers.Dtos
|
||||
{
|
||||
public class XCategoryRepositoryService : XBaseRepositoryService<XCategory, XCategoryDto, int>, IXCategoryRepositoryService
|
||||
{
|
||||
public XCategoryRepositoryService(
|
||||
IXCategoryRepository repository,
|
||||
IEnumerable<Profile> mapperProfiles = null
|
||||
) : base(
|
||||
repository,
|
||||
mapperProfiles
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xCategoryService.Interfaces.Dtos;
|
||||
using xCategoryService.Models.Dtos;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityService.Interfaces;
|
||||
using xPushService.Base;
|
||||
|
||||
namespace xCategoryService.Providers.Dtos
|
||||
{
|
||||
public class XCategoryServiceProvider : XBaseDtoProvider<XCategory, XCategoryDto, int, XCategoryDtoHub>, IXCategoryServiceProvider
|
||||
{
|
||||
public XCategoryServiceProvider(
|
||||
IHubContext<XCategoryDtoHub> hub,
|
||||
XDataServiceConfiguration dataConfiguration,
|
||||
IXCategoryRepositoryService service,
|
||||
IXIdentityProvider identityProvider = null
|
||||
) : base(
|
||||
hub,
|
||||
dataConfiguration,
|
||||
service,
|
||||
identityProvider
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Db;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xCategoryService.Providers.Entities
|
||||
{
|
||||
public class XCategoryEFRepository<TContext> : XBaseEFRepository<XCategory, int, TContext>, IXCategoryRepository
|
||||
where TContext : XDbContext
|
||||
{
|
||||
public XCategoryEFRepository(
|
||||
IXUnitOfWorks<TContext> unitOfWorks,
|
||||
XDataServiceConfiguration configuration,
|
||||
IXCategoryKeyGenerator keyGenerator = null,
|
||||
IXCategoryRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
unitOfWorks,
|
||||
configuration,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xPushService.Base;
|
||||
|
||||
namespace xCategoryService.Providers.Entities
|
||||
{
|
||||
public class XCategoryEntityHub : XBaseEntityHub<XCategory, int>, IXCategoryEntityHub
|
||||
{
|
||||
public XCategoryEntityHub(
|
||||
ILogger<XCategoryEntityHub> logger
|
||||
) : base(logger)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xCategoryService.Providers.Entities
|
||||
{
|
||||
public class XCategoryInMemoryRepository : XBaseInMemoryRepository<XCategory, int>, IXCategoryRepository
|
||||
{
|
||||
public XCategoryInMemoryRepository(
|
||||
XDataServiceConfiguration configuration,
|
||||
IXCategoryKeyGenerator keyGenerator = null,
|
||||
IXCategoryRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
configuration,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xCategoryService.Providers.Entities
|
||||
{
|
||||
public class XCategoryKeyGenerator : XIntKeyGenerator<XCategory>, IXCategoryKeyGenerator
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xCategoryService.Providers.Entities
|
||||
{
|
||||
public class XCategoryMongoRepository : XBaseMongoRepository<XCategory, int>, IXCategoryRepository
|
||||
{
|
||||
public XCategoryMongoRepository(
|
||||
XDataBaseConfiguration dbConfiguration,
|
||||
XDataServiceConfiguration configuration,
|
||||
string collectionName = null,
|
||||
IXCategoryKeyGenerator keyGenerator = null,
|
||||
IXCategoryRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
dbConfiguration,
|
||||
configuration,
|
||||
collectionName,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xCategoryService.Providers.Entities
|
||||
{
|
||||
public class XCategoryRepositoryEvents : XBaseRepositoryEvents<XCategory>, IXCategoryRepositoryEvents
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityService.Interfaces;
|
||||
using xPushService.Base;
|
||||
|
||||
namespace xCategoryService.Providers.Entities
|
||||
{
|
||||
public class XCategoryRepositoryProvider : XBaseEntityProvider<XCategory, int, XCategoryEntityHub>, IXCategoryRepositoryProvider
|
||||
{
|
||||
public XCategoryRepositoryProvider(
|
||||
IHubContext<XCategoryEntityHub> hub,
|
||||
IXCategoryRepository repository,
|
||||
XDataServiceConfiguration dataConfiguration,
|
||||
IXIdentityProvider identityProvider = null
|
||||
) : base(
|
||||
hub,
|
||||
repository,
|
||||
dataConfiguration,
|
||||
identityProvider
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.GraphQL;
|
||||
|
||||
namespace xCategoryService.Providers.GraphQL
|
||||
{
|
||||
public class XCategoryGraphQLTypeHelper : XBaseGraphQLTypeHelper<XCategory, int>, IXCategoryGraphQLTypeHelper
|
||||
{
|
||||
public XCategoryGraphQLTypeHelper(
|
||||
XDataServiceConfiguration configuration
|
||||
) : base(configuration)
|
||||
{ }
|
||||
|
||||
public override string GetInQueryCollectionName()
|
||||
{
|
||||
return "categories";
|
||||
}
|
||||
|
||||
public override string GetInQuerySingleName()
|
||||
{
|
||||
return "category";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using GraphQL.Types;
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.GraphQL;
|
||||
|
||||
namespace xCategoryService.Providers.GraphQL
|
||||
{
|
||||
public class XCategoryGraphQuery : XBaseGraphQLQuery<XCategory, int, XCategoryGraphType, IntGraphType>
|
||||
{
|
||||
public XCategoryGraphQuery(
|
||||
XDataServiceConfiguration configuration,
|
||||
IXCategoryRepository repository,
|
||||
IXCategoryGraphQLTypeHelper helper
|
||||
) : base(
|
||||
configuration,
|
||||
repository,
|
||||
helper
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using GraphQL.Types;
|
||||
|
||||
namespace xCategoryService.Providers.GraphQL
|
||||
{
|
||||
public class XCategoryGraphSchema : Schema
|
||||
{
|
||||
public XCategoryGraphSchema(IServiceProvider services) : base(services)
|
||||
{
|
||||
Query = (XCategoryGraphQuery)services.GetService(typeof(XCategoryGraphQuery));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.GraphQL;
|
||||
|
||||
namespace xCategoryService.Providers.GraphQL
|
||||
{
|
||||
public class XCategoryGraphType : XBaseGraphObjectType<XCategory, int>
|
||||
{
|
||||
public XCategoryGraphType() : base()
|
||||
{
|
||||
Field(x => x.Title);
|
||||
Field(x => x.Description);
|
||||
Field(x => x.References);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.GraphQL;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xCategoryService.Providers.GraphQL
|
||||
{
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using xCategoryService.Interfaces;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Providers;
|
||||
|
||||
namespace xCategoryService.Providers
|
||||
{
|
||||
public class XCategoryDescriptionResourceProvider : XBaseItemResourceProvider, IXCategoryDescriptionResourceProvider
|
||||
{
|
||||
public XCategoryDescriptionResourceProvider(
|
||||
IXStringServiceProvider stringProvider
|
||||
) : base(
|
||||
item: "CatD",
|
||||
stringProvider
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xCategoryService.Configurations.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xCategoryService.Providers
|
||||
{
|
||||
public class XCategoryEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar
|
||||
{
|
||||
public XCategoryEntityRegisterar()
|
||||
: base(nameof(XCategoryEntityRegisterar))
|
||||
{
|
||||
//
|
||||
// Add XCategory Entity ...
|
||||
AddEntity<XCategory, int>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configure Entities ...
|
||||
/// </summary>
|
||||
/// <param name="modelBuilder"></param>
|
||||
public override void ConfigureEntities(ModelBuilder modelBuilder)
|
||||
{
|
||||
//
|
||||
// Configure Entity Using Provided ...
|
||||
modelBuilder
|
||||
.ApplyConfigurationsFromAssembly(typeof(XCategoryEntityConfiguration).Assembly);
|
||||
|
||||
//
|
||||
base.ConfigureEntities(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using xCategoryService.Interfaces;
|
||||
using xCategoryService.Interfaces.Entities;
|
||||
using xCategoryService.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xCategoryService.Providers
|
||||
{
|
||||
public abstract class XCategorySeederBase : XBaseDbSeeder<XCategory, int>, IXCategorySeeder
|
||||
{
|
||||
protected XCategorySeederBase(
|
||||
string entity,
|
||||
string database,
|
||||
IXCategoryRepository repository,
|
||||
XDataServiceConfiguration dataServiceConfiguration
|
||||
) : base(
|
||||
entity,
|
||||
database,
|
||||
repository,
|
||||
dataServiceConfiguration
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using xCategoryService.Interfaces;
|
||||
using xStringService.Interfaces.Dtos;
|
||||
using xStringService.Providers;
|
||||
|
||||
namespace xCategoryService.Providers
|
||||
{
|
||||
public class XCategoryTitleResourceProvider : XBaseItemResourceProvider, IXCategoryTitleResourceProvider
|
||||
{
|
||||
public XCategoryTitleResourceProvider(
|
||||
IXStringServiceProvider stringProvider
|
||||
) : base(
|
||||
item: "CatT",
|
||||
stringProvider
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ namespace xCategoryService.Providers
|
||||
public class XSubCategoryDescriptionResourceProvider : XBaseItemResourceProvider, IXSubCategoryDescriptionResourceProvider
|
||||
{
|
||||
public XSubCategoryDescriptionResourceProvider(
|
||||
string item,
|
||||
IXStringServiceProvider stringProvider
|
||||
) : base(
|
||||
item: "SubCatD",
|
||||
|
||||
Reference in New Issue
Block a user