diff --git a/DI/XDIHelperExtension.cs b/DI/XDIHelperExtension.cs index cb1eb57..ee2089f 100644 --- a/DI/XDIHelperExtension.cs +++ b/DI/XDIHelperExtension.cs @@ -177,7 +177,7 @@ namespace xStringService.DI // descriptor = typeof(XStringServiceHelper) .InvokeGenericMethod( - methodName: "GetXStringEfRepositoryDescriptor", + methodName: "GetXStringEFRepositoryDescriptor", runtimeType: contextType, args: null ); diff --git a/Configurations/.gitkeep b/Extensions/.gitkeep similarity index 100% rename from Configurations/.gitkeep rename to Extensions/.gitkeep diff --git a/Extensions/XModelExtensions.cs b/Extensions/XModelExtensions.cs index 5a2ec58..26cda9a 100644 --- a/Extensions/XModelExtensions.cs +++ b/Extensions/XModelExtensions.cs @@ -9,51 +9,6 @@ namespace xStringService.Extensions { public static class XModelExtensions { - /// - /// Converts an Entity to Dto Representation ... - /// - /// - /// - public static XStringDto ToXStringDto(this XString source) - { - // - XStringDto result = new XStringDto(); - - // - result.Id = source.Id; - result.Language = source.Language; - result.ResourceTitle = source.ResourceTitle; - result.TranslatedValue = source.TranslatedValue; - - // - return result; - } - - /// - /// Converts a Collection of Entities to Dto ... - /// - /// - /// - public static IEnumerable ToXStringDtos(this IEnumerable source) - { - // - var list = new List(); - - // - // Validate ... - bool isValid = source.HasChild(); - if (!isValid) - { - return list.AsEnumerable(); - } - - // - var result = source.Select(e => ToXStringDto(e)); - - // - return result; - } - /// /// Converts an Entity to LocaleResource Dto ... /// diff --git a/Helpers/.gitkeep b/Helpers/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Helpers/XStringServiceHelper.cs b/Helpers/XStringServiceHelper.cs index 1614812..7ab0732 100644 --- a/Helpers/XStringServiceHelper.cs +++ b/Helpers/XStringServiceHelper.cs @@ -1,5 +1,4 @@ using GraphQL.Types; -using MongoDB.Bson.Serialization.Serializers; using xDataHelper.Providers.GraphQL; using xDataService.Db; using xDataService.Models; @@ -32,7 +31,7 @@ namespace xStringService.Helpers IXStringRepository, XStringEFRepository, TContext - > GetXStringEfRepositoryDescriptor() + > GetXStringEFRepositoryDescriptor() where TContext : XDbContext { // @@ -76,7 +75,7 @@ namespace xStringService.Helpers TContext, IXStringSeeder, TSeederImplementation - > GetXStringEfRepositoryDescriptor() + > GetXStringEFRepositoryDescriptor() where TContext : XDbContext where TSeederImplementation : XBaseDbSeeder { diff --git a/Interfaces/.gitkeep b/Interfaces/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Interfaces/Entities/IXStringRepositoryProvider.cs b/Interfaces/Entities/IXStringRepositoryProvider.cs index cf3fa52..8fccaa4 100644 --- a/Interfaces/Entities/IXStringRepositoryProvider.cs +++ b/Interfaces/Entities/IXStringRepositoryProvider.cs @@ -4,6 +4,6 @@ using xStringService.Providers.Entities; namespace xStringService.Interfaces.Entities { - public interface IXStringRepositoryProvider : IXBaseEntityProviderr + public interface IXStringRepositoryProvider : IXBaseEntityProvider { } } \ No newline at end of file diff --git a/Models/.gitkeep b/Models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Providers/.gitkeep b/Providers/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index 378e671..c3ff7a5 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,8 @@ it is a Part of xDashboard on SaherElm IT Center which provides: this module has following dependencies : -- xModels -- xCommons - xDataService - xPushService -- xIdentityModels - xIdentityService for configure and use this Module refer to DI.XDIHelperExtension.cs file. @@ -615,6 +612,53 @@ public abstract class XBaseStringResourceProvider : IXBaseStringResourceProvider } ``` +### Controllers + +there are some abstraction Layer of Controller Implementation for using Provided Services for managing data. + +- **XStringRepositoryControllerBase**: an abstract Controller for Provide Repository Actions (using Entity). +- **XStringRepositoryProviderControllerBase**: an abstract Controller for Provide Repository Actions (using Entity and XEntityHub). +- **XStringServiceControllerBase**: an abstract Controller for Provide Service Actions (using Dto). +- **XStringServiceProviderControllerBase**: an abstract Controller for Provide Service Actions (using Dto and XDtoHub). +- **XBaseStringResourceProviderControllerBase**: an abstract Controller for Provide Actions for Base String Resources. + +## Implementation + +you have to follow these steps for using this Module. + +- **DI Registration**: in this phase, all Provided Services Registered in DI. +- **Middleware Usage**: in this phase, Service Middlewares Use to Handle Features. + +```C# +public class Startup +{ + // + public void ConfigureServices(IServiceCollection services) + { + ... + // + // Register String Service ... + services.AddXStringService( + lifeTime: lifeTime, + repositoryType: xDataService.Constants.XRepositoryType.EF + ); + ... + } + + // + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + ... + // + // Using String Service ... + app.UseXStringService( + isDevelopmentEnvironment: isDevelopmentEnvironment + ); + ... + } +} +``` + ## Maintainer Hadi Khazaee asl