diff --git a/Configurations/Entities/XCategoryEntityConfiguration.cs b/Configurations/Entities/XCategoryEntityConfiguration.cs new file mode 100644 index 0000000..018f600 --- /dev/null +++ b/Configurations/Entities/XCategoryEntityConfiguration.cs @@ -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 + { + public override void Configure(EntityTypeBuilder builder) + { + builder.ToTable("Categories"); + } + } +} \ No newline at end of file diff --git a/DI/XDIHelperExtension.cs b/DI/XDIHelperExtension.cs index bd535aa..ceab725 100644 --- a/DI/XDIHelperExtension.cs +++ b/DI/XDIHelperExtension.cs @@ -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("tagDto"); - pushHelper.AddHub("tagEntity"); + // Category ... + pushHelper.AddHub("categoryDto"); + pushHelper.AddHub("categoryEntity"); + + // + // SubCategory ... + pushHelper.AddHub("subCategoryDto"); + pushHelper.AddHub("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; /// /// a LogTag for Service ... @@ -176,7 +195,17 @@ namespace xCategoryService.DI // case XRepositoryType.EF: // - subCategoryescriptor = typeof(XCategoryServiceHelper) + // Category ... + categoryDescriptor = typeof(XCategoryServiceHelper) + .InvokeGenericMethod( + methodName: "GetXCategoryEFRepositoryDescriptor", + runtimeType: contextType, + args: null + ); + + // + // SubCategory ... + subCategoryDescriptor = typeof(XCategoryServiceHelper) .InvokeGenericMethod( 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 ..."); } diff --git a/Helpers/XCategoryServiceHelper.cs b/Helpers/XCategoryServiceHelper.cs index 5570d50..2e8676b 100644 --- a/Helpers/XCategoryServiceHelper.cs +++ b/Helpers/XCategoryServiceHelper.cs @@ -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 + > GetXCategoryEFRepositoryDescriptor() + where TContext : XDbContext + { + // + var result = new XEFRepositoryDescriptor< + XCategory, + int, + IXCategoryKeyGenerator, + XCategoryKeyGenerator, + IXCategoryRepositoryEvents, + XCategoryRepositoryEvents, + XCategoryGraphType, + IntGraphType, + XCategoryGraphQuery, + IXCategoryGraphQLTypeHelper, + XCategoryGraphQLTypeHelper, + XCategoryGraphSchema, + IXCategoryRepository, + XCategoryEFRepository, + TContext + >(); + + // + return result; + } + + public static XEFRepositoryDescriptor< + XCategory, + int, + IXCategoryKeyGenerator, + XCategoryKeyGenerator, + IXCategoryRepositoryEvents, + XCategoryRepositoryEvents, + XCategoryGraphType, + IntGraphType, + XCategoryGraphQuery, + IXCategoryGraphQLTypeHelper, + XCategoryGraphQLTypeHelper, + XCategoryGraphSchema, + IXCategoryRepository, + XCategoryEFRepository, + TContext, + IXCategorySeeder, + TSeederImplementation + > GetXCategoryEFRepositoryDescriptor() + where TContext : XDbContext + where TSeederImplementation : XBaseDbSeeder + { + // + var result = new XEFRepositoryDescriptor< + XCategory, + int, + IXCategoryKeyGenerator, + XCategoryKeyGenerator, + IXCategoryRepositoryEvents, + XCategoryRepositoryEvents, + XCategoryGraphType, + IntGraphType, + XCategoryGraphQuery, + IXCategoryGraphQLTypeHelper, + XCategoryGraphQLTypeHelper, + XCategoryGraphSchema, + IXCategoryRepository, + XCategoryEFRepository, + 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() + where TSeederImplementation : XBaseDbSeeder + { + // + 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() + where TSeederImplementation : XBaseDbSeeder + { + // + 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 } } \ No newline at end of file diff --git a/Interfaces/Dtos/IXCategoryDtoHub.cs b/Interfaces/Dtos/IXCategoryDtoHub.cs new file mode 100644 index 0000000..3a925ce --- /dev/null +++ b/Interfaces/Dtos/IXCategoryDtoHub.cs @@ -0,0 +1,9 @@ +using xCategoryService.Models.Dtos; +using xCategoryService.Models.Entities; +using xPushService.Interfaces; + +namespace xCategoryService.Interfaces.Dtos +{ + public interface IXCategoryDtoHub : IXBaseDtoHub + { } +} \ No newline at end of file diff --git a/Interfaces/Dtos/IXCategoryRepositoryService.cs b/Interfaces/Dtos/IXCategoryRepositoryService.cs new file mode 100644 index 0000000..b2b8b4c --- /dev/null +++ b/Interfaces/Dtos/IXCategoryRepositoryService.cs @@ -0,0 +1,9 @@ +using xCategoryService.Models.Dtos; +using xCategoryService.Models.Entities; +using xDataService.Interfaces; + +namespace xCategoryService.Interfaces.Dtos +{ + public interface IXCategoryRepositoryService : IXBaseRepositoryService + { } +} \ No newline at end of file diff --git a/Interfaces/Dtos/IXCategoryServiceProvider.cs b/Interfaces/Dtos/IXCategoryServiceProvider.cs new file mode 100644 index 0000000..ab15b23 --- /dev/null +++ b/Interfaces/Dtos/IXCategoryServiceProvider.cs @@ -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 + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXCategoryEntityHub.cs b/Interfaces/Entities/IXCategoryEntityHub.cs new file mode 100644 index 0000000..08e321d --- /dev/null +++ b/Interfaces/Entities/IXCategoryEntityHub.cs @@ -0,0 +1,8 @@ +using xCategoryService.Models.Entities; +using xPushService.Interfaces; + +namespace xCategoryService.Interfaces.Entities +{ + public interface IXCategoryEntityHub : IXBaseEntityHub + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXCategoryGraphQLTypeHelper.cs b/Interfaces/Entities/IXCategoryGraphQLTypeHelper.cs new file mode 100644 index 0000000..ddcb4cd --- /dev/null +++ b/Interfaces/Entities/IXCategoryGraphQLTypeHelper.cs @@ -0,0 +1,8 @@ +using xCategoryService.Models.Entities; +using xDataService.Interfaces; + +namespace xCategoryService.Interfaces.Entities +{ + public interface IXCategoryGraphQLTypeHelper : IXBaseGraphQLTypeHelper + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXCategoryKeyGenerator.cs b/Interfaces/Entities/IXCategoryKeyGenerator.cs new file mode 100644 index 0000000..452a9e3 --- /dev/null +++ b/Interfaces/Entities/IXCategoryKeyGenerator.cs @@ -0,0 +1,8 @@ +using xCategoryService.Models.Entities; +using xDataService.Interfaces; + +namespace xCategoryService.Interfaces.Entities +{ + public interface IXCategoryKeyGenerator : IXKeyGenerator + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXCategoryRepository.cs b/Interfaces/Entities/IXCategoryRepository.cs new file mode 100644 index 0000000..793e697 --- /dev/null +++ b/Interfaces/Entities/IXCategoryRepository.cs @@ -0,0 +1,8 @@ +using xCategoryService.Models.Entities; +using xDataService.Interfaces; + +namespace xCategoryService.Interfaces.Entities +{ + public interface IXCategoryRepository : IXBaseRepository + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXCategoryRepositoryEvents.cs b/Interfaces/Entities/IXCategoryRepositoryEvents.cs new file mode 100644 index 0000000..0b07751 --- /dev/null +++ b/Interfaces/Entities/IXCategoryRepositoryEvents.cs @@ -0,0 +1,8 @@ +using xCategoryService.Models.Entities; +using xDataService.Interfaces; + +namespace xCategoryService.Interfaces.Entities +{ + public interface IXCategoryRepositoryEvents : IXBaseRepositoryEvents + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXCategoryRepositoryProvider.cs b/Interfaces/Entities/IXCategoryRepositoryProvider.cs new file mode 100644 index 0000000..ef2dd73 --- /dev/null +++ b/Interfaces/Entities/IXCategoryRepositoryProvider.cs @@ -0,0 +1,9 @@ +using xCategoryService.Models.Entities; +using xCategoryService.Providers.Entities; +using xPushService.Interfaces; + +namespace xCategoryService.Interfaces.Entities +{ + public interface IXCategoryRepositoryProvider : IXBaseEntityProvider + { } +} \ No newline at end of file diff --git a/Interfaces/IXCategoryDescriptionResourceProvider.cs b/Interfaces/IXCategoryDescriptionResourceProvider.cs new file mode 100644 index 0000000..6107ae7 --- /dev/null +++ b/Interfaces/IXCategoryDescriptionResourceProvider.cs @@ -0,0 +1,7 @@ +using xStringService.Interfaces; + +namespace xCategoryService.Interfaces +{ + public interface IXCategoryDescriptionResourceProvider : IXItemResourceProvider + { } +} \ No newline at end of file diff --git a/Interfaces/IXCategorySeeder.cs b/Interfaces/IXCategorySeeder.cs new file mode 100644 index 0000000..d7f8abc --- /dev/null +++ b/Interfaces/IXCategorySeeder.cs @@ -0,0 +1,8 @@ +using xCategoryService.Models.Entities; +using xDataService.Interfaces; + +namespace xCategoryService.Interfaces +{ + public interface IXCategorySeeder : IXBaseDbSeeder + { } +} \ No newline at end of file diff --git a/Interfaces/IXCategoryTitleResourceProvider.cs b/Interfaces/IXCategoryTitleResourceProvider.cs new file mode 100644 index 0000000..039ee2f --- /dev/null +++ b/Interfaces/IXCategoryTitleResourceProvider.cs @@ -0,0 +1,7 @@ +using xStringService.Interfaces; + +namespace xCategoryService.Interfaces +{ + public interface IXCategoryTitleResourceProvider : IXItemResourceProvider + { } +} \ No newline at end of file diff --git a/Models/Dtos/XCategoryDto.cs b/Models/Dtos/XCategoryDto.cs new file mode 100644 index 0000000..fc4bc48 --- /dev/null +++ b/Models/Dtos/XCategoryDto.cs @@ -0,0 +1,28 @@ +using xModels.Base; + +namespace xCategoryService.Models.Dtos +{ + public class XCategoryDto : XBaseIntIDEntityDto + { + /// + /// Title of SubCategory ... + /// this is a Resource Title ... + /// + /// + public string Title { get; set; } + + /// + /// Description of SubCategory ... + /// this is a Resource Title ... + /// + /// + public string Description { get; set; } + + /// + /// References List String Representation ... + /// each SubCategory Referenced to Category ID which List here ... + /// + /// + public string References { get; set; } + } +} \ No newline at end of file diff --git a/Models/Entities/XCategory.cs b/Models/Entities/XCategory.cs new file mode 100644 index 0000000..449b558 --- /dev/null +++ b/Models/Entities/XCategory.cs @@ -0,0 +1,28 @@ +using xModels.Base; + +namespace xCategoryService.Models.Entities +{ + public class XCategory : XBaseIntIDEntity + { + /// + /// Title of SubCategory ... + /// this is a Resource Title ... + /// + /// + public string Title { get; set; } + + /// + /// Description of SubCategory ... + /// this is a Resource Title ... + /// + /// + public string Description { get; set; } + + /// + /// References List String Representation ... + /// each SubCategory Referenced to Category ID which List here ... + /// + /// + public string References { get; set; } + } +} \ No newline at end of file diff --git a/Providers/Dtos/XCategoryDtoHub.cs b/Providers/Dtos/XCategoryDtoHub.cs new file mode 100644 index 0000000..fafdb60 --- /dev/null +++ b/Providers/Dtos/XCategoryDtoHub.cs @@ -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, IXCategoryDtoHub + { + public XCategoryDtoHub( + ILogger logger + ) : base(logger) + { } + } +} \ No newline at end of file diff --git a/Providers/Dtos/XCategoryRepositoryService.cs b/Providers/Dtos/XCategoryRepositoryService.cs new file mode 100644 index 0000000..8347a05 --- /dev/null +++ b/Providers/Dtos/XCategoryRepositoryService.cs @@ -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, IXCategoryRepositoryService + { + public XCategoryRepositoryService( + IXCategoryRepository repository, + IEnumerable mapperProfiles = null + ) : base( + repository, + mapperProfiles + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Dtos/XCategoryServiceProvider.cs b/Providers/Dtos/XCategoryServiceProvider.cs new file mode 100644 index 0000000..914f795 --- /dev/null +++ b/Providers/Dtos/XCategoryServiceProvider.cs @@ -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, IXCategoryServiceProvider + { + public XCategoryServiceProvider( + IHubContext hub, + XDataServiceConfiguration dataConfiguration, + IXCategoryRepositoryService service, + IXIdentityProvider identityProvider = null + ) : base( + hub, + dataConfiguration, + service, + identityProvider + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XCategoryEFRepository.cs b/Providers/Entities/XCategoryEFRepository.cs new file mode 100644 index 0000000..2b4ac53 --- /dev/null +++ b/Providers/Entities/XCategoryEFRepository.cs @@ -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 : XBaseEFRepository, IXCategoryRepository + where TContext : XDbContext + { + public XCategoryEFRepository( + IXUnitOfWorks unitOfWorks, + XDataServiceConfiguration configuration, + IXCategoryKeyGenerator keyGenerator = null, + IXCategoryRepositoryEvents baseRepositoryEvents = null + ) : base( + unitOfWorks, + configuration, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XCategoryEntityHub.cs b/Providers/Entities/XCategoryEntityHub.cs new file mode 100644 index 0000000..25f8b75 --- /dev/null +++ b/Providers/Entities/XCategoryEntityHub.cs @@ -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, IXCategoryEntityHub + { + public XCategoryEntityHub( + ILogger logger + ) : base(logger) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XCategoryInMemoryRepository.cs b/Providers/Entities/XCategoryInMemoryRepository.cs new file mode 100644 index 0000000..79a5ff0 --- /dev/null +++ b/Providers/Entities/XCategoryInMemoryRepository.cs @@ -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, IXCategoryRepository + { + public XCategoryInMemoryRepository( + XDataServiceConfiguration configuration, + IXCategoryKeyGenerator keyGenerator = null, + IXCategoryRepositoryEvents baseRepositoryEvents = null + ) : base( + configuration, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XCategoryKeyGenerator.cs b/Providers/Entities/XCategoryKeyGenerator.cs new file mode 100644 index 0000000..4431a86 --- /dev/null +++ b/Providers/Entities/XCategoryKeyGenerator.cs @@ -0,0 +1,9 @@ +using xCategoryService.Interfaces.Entities; +using xCategoryService.Models.Entities; +using xDataService.Providers; + +namespace xCategoryService.Providers.Entities +{ + public class XCategoryKeyGenerator : XIntKeyGenerator, IXCategoryKeyGenerator + { } +} \ No newline at end of file diff --git a/Providers/Entities/XCategoryMongoRepository.cs b/Providers/Entities/XCategoryMongoRepository.cs new file mode 100644 index 0000000..7e4f116 --- /dev/null +++ b/Providers/Entities/XCategoryMongoRepository.cs @@ -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, IXCategoryRepository + { + public XCategoryMongoRepository( + XDataBaseConfiguration dbConfiguration, + XDataServiceConfiguration configuration, + string collectionName = null, + IXCategoryKeyGenerator keyGenerator = null, + IXCategoryRepositoryEvents baseRepositoryEvents = null + ) : base( + dbConfiguration, + configuration, + collectionName, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XCategoryRepositoryEvents.cs b/Providers/Entities/XCategoryRepositoryEvents.cs new file mode 100644 index 0000000..ec1be13 --- /dev/null +++ b/Providers/Entities/XCategoryRepositoryEvents.cs @@ -0,0 +1,9 @@ +using xCategoryService.Interfaces.Entities; +using xCategoryService.Models.Entities; +using xDataService.Providers; + +namespace xCategoryService.Providers.Entities +{ + public class XCategoryRepositoryEvents : XBaseRepositoryEvents, IXCategoryRepositoryEvents + { } +} \ No newline at end of file diff --git a/Providers/Entities/XCategoryRepositoryProvider.cs b/Providers/Entities/XCategoryRepositoryProvider.cs new file mode 100644 index 0000000..aa6053a --- /dev/null +++ b/Providers/Entities/XCategoryRepositoryProvider.cs @@ -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, IXCategoryRepositoryProvider + { + public XCategoryRepositoryProvider( + IHubContext hub, + IXCategoryRepository repository, + XDataServiceConfiguration dataConfiguration, + IXIdentityProvider identityProvider = null + ) : base( + hub, + repository, + dataConfiguration, + identityProvider + ) + { } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XCategoryGraphQLTypeHelper.cs b/Providers/GraphQL/XCategoryGraphQLTypeHelper.cs new file mode 100644 index 0000000..23c6882 --- /dev/null +++ b/Providers/GraphQL/XCategoryGraphQLTypeHelper.cs @@ -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, IXCategoryGraphQLTypeHelper + { + public XCategoryGraphQLTypeHelper( + XDataServiceConfiguration configuration + ) : base(configuration) + { } + + public override string GetInQueryCollectionName() + { + return "categories"; + } + + public override string GetInQuerySingleName() + { + return "category"; + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XCategoryGraphQuery.cs b/Providers/GraphQL/XCategoryGraphQuery.cs new file mode 100644 index 0000000..feff532 --- /dev/null +++ b/Providers/GraphQL/XCategoryGraphQuery.cs @@ -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 + { + public XCategoryGraphQuery( + XDataServiceConfiguration configuration, + IXCategoryRepository repository, + IXCategoryGraphQLTypeHelper helper + ) : base( + configuration, + repository, + helper + ) + { } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XCategoryGraphSchema.cs b/Providers/GraphQL/XCategoryGraphSchema.cs new file mode 100644 index 0000000..d39fb45 --- /dev/null +++ b/Providers/GraphQL/XCategoryGraphSchema.cs @@ -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)); + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XCategoryGraphType.cs b/Providers/GraphQL/XCategoryGraphType.cs new file mode 100644 index 0000000..a77e2dd --- /dev/null +++ b/Providers/GraphQL/XCategoryGraphType.cs @@ -0,0 +1,15 @@ +using xCategoryService.Models.Entities; +using xDataService.GraphQL; + +namespace xCategoryService.Providers.GraphQL +{ + public class XCategoryGraphType : XBaseGraphObjectType + { + public XCategoryGraphType() : base() + { + Field(x => x.Title); + Field(x => x.Description); + Field(x => x.References); + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XSubCategoryGraphQuery.cs b/Providers/GraphQL/XSubCategoryGraphQuery.cs index 7ccc651..9950c11 100644 --- a/Providers/GraphQL/XSubCategoryGraphQuery.cs +++ b/Providers/GraphQL/XSubCategoryGraphQuery.cs @@ -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 { diff --git a/Providers/XCategoryDescriptionResourceProvider.cs b/Providers/XCategoryDescriptionResourceProvider.cs new file mode 100644 index 0000000..f40c4fc --- /dev/null +++ b/Providers/XCategoryDescriptionResourceProvider.cs @@ -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 + ) + { } + } +} \ No newline at end of file diff --git a/Providers/XCategoryEntityRegisterar.cs b/Providers/XCategoryEntityRegisterar.cs new file mode 100644 index 0000000..71722d0 --- /dev/null +++ b/Providers/XCategoryEntityRegisterar.cs @@ -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(); + } + + /// + /// Configure Entities ... + /// + /// + public override void ConfigureEntities(ModelBuilder modelBuilder) + { + // + // Configure Entity Using Provided ... + modelBuilder + .ApplyConfigurationsFromAssembly(typeof(XCategoryEntityConfiguration).Assembly); + + // + base.ConfigureEntities(modelBuilder); + } + } +} \ No newline at end of file diff --git a/Providers/XCategorySeederBase.cs b/Providers/XCategorySeederBase.cs new file mode 100644 index 0000000..573caee --- /dev/null +++ b/Providers/XCategorySeederBase.cs @@ -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, IXCategorySeeder + { + protected XCategorySeederBase( + string entity, + string database, + IXCategoryRepository repository, + XDataServiceConfiguration dataServiceConfiguration + ) : base( + entity, + database, + repository, + dataServiceConfiguration + ) + { } + } +} \ No newline at end of file diff --git a/Providers/XCategoryTitleResourceProvider.cs b/Providers/XCategoryTitleResourceProvider.cs new file mode 100644 index 0000000..2a86e2c --- /dev/null +++ b/Providers/XCategoryTitleResourceProvider.cs @@ -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 + ) + { } + } +} \ No newline at end of file diff --git a/Providers/XSubCategoryDescriptionResourceProvider.cs b/Providers/XSubCategoryDescriptionResourceProvider.cs index 4fb6313..9ac27da 100644 --- a/Providers/XSubCategoryDescriptionResourceProvider.cs +++ b/Providers/XSubCategoryDescriptionResourceProvider.cs @@ -7,7 +7,6 @@ namespace xCategoryService.Providers public class XSubCategoryDescriptionResourceProvider : XBaseItemResourceProvider, IXSubCategoryDescriptionResourceProvider { public XSubCategoryDescriptionResourceProvider( - string item, IXStringServiceProvider stringProvider ) : base( item: "SubCatD",