From c03ca66498f6b5948723ac525549dfac8ecf2a88 Mon Sep 17 00:00:00 2001 From: Ali Yousefi Date: Sun, 24 Dec 2023 19:31:31 +0330 Subject: [PATCH] update packages and fix some methods in multiple language requests --- .../EasyMicroservices.Cores.AspCoreApi.csproj | 2 +- ...tilingualReadableQueryServiceController.cs | 30 +++++++++++++++++-- ...ces.Cores.AspEntityFrameworkCoreApi.csproj | 2 +- .../EasyMicroservices.Cores.Clients.csproj | 2 +- .../GetByLanguageRequestContract.cs | 22 ++++++++++++++ .../EasyMicroservices.Cores.Contracts.csproj | 2 +- .../EasyMicroservices.Cores.Database.csproj | 2 +- ...oservices.Cores.EntityFrameworkCore.csproj | 2 +- ...ores.Relational.EntityFrameworkCore.csproj | 2 +- 9 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 src/CSharp/EasyMicroservices.Cores.Contracts/Contracts/Requests/Multilingual/GetByLanguageRequestContract.cs diff --git a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj index 10a7321..e4e7d44 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj +++ b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj @@ -4,7 +4,7 @@ net6.0;net7.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.70 + 0.0.0.71 asp core servces. EasyMicroservices@gmail.com core,cores,base,database,services,asp,aspnet diff --git a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/MultilingualReadableQueryServiceController.cs b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/MultilingualReadableQueryServiceController.cs index 9b8e6b6..75816d1 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/MultilingualReadableQueryServiceController.cs +++ b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/MultilingualReadableQueryServiceController.cs @@ -97,6 +97,17 @@ async Task> ResolveContentAllLanguage return mapped; } + async Task> ResolveContentAllLanguage(ListMessageContract result) + { + if (!result) + return result.ToListContract(); + var contentResolver = UnitOfWork.GetContentResolver(); + var mapper = UnitOfWork.GetMapper(); + var mapped = mapper.MapToList(result.Result); + await contentResolver.ResolveContentAllLanguage(mapped); + return mapped; + } + /// /// /// @@ -169,7 +180,7 @@ public virtual async Task> Filter(TFilter /// /// [HttpPost] - public async Task> FilterAllLanguage(TFilterContract filterRequest, CancellationToken cancellationToken = default) + public async Task> FilterAllLanguage(TFilterContract filterRequest, CancellationToken cancellationToken = default) { var result = await ContractLogic.Filter(filterRequest, OnGetAllQuery(), cancellationToken); return await ResolveContentAllLanguage(result); @@ -187,13 +198,26 @@ public virtual async Task> GetAll(Cancell return await ResolveContentLanguage(result, default); } + /// + /// + /// + /// + /// + /// + [HttpPost] + public async Task> GetAllByLanguage(GetByLanguageRequestContract getByLanguageRequest, CancellationToken cancellationToken = default) + { + var result = await ContractLogic.GetAll(OnGetAllQuery(), cancellationToken); + return await ResolveContentLanguage(result, getByLanguageRequest.LanguageShortName); + } + /// /// /// /// /// [HttpPost] - public async Task> GetAllWithAllLanguage(CancellationToken cancellationToken = default) + public async Task> GetAllWithAllLanguage(CancellationToken cancellationToken = default) { var result = await ContractLogic.GetAll(OnGetAllQuery(), cancellationToken); return await ResolveContentAllLanguage(result); @@ -218,7 +242,7 @@ public virtual async Task> GetAllByUnique /// /// [HttpPost] - public async Task> GetAllByUniqueIdentityAllLanguage(GetByUniqueIdentityRequestContract request, CancellationToken cancellationToken = default) + public async Task> GetAllByUniqueIdentityAllLanguage(GetByUniqueIdentityRequestContract request, CancellationToken cancellationToken = default) { var result = await ContractLogic.GetAllByUniqueIdentity(request, request.Type, OnGetAllQuery(), cancellationToken); return await ResolveContentAllLanguage(result); diff --git a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj index a376c7f..0e13dc0 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj +++ b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj @@ -4,7 +4,7 @@ net6.0;net7.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.70 + 0.0.0.71 asp core servces. EasyMicroservices@gmail.com core,cores,base,database,services,asp,aspnet,aspcore,efcore diff --git a/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj b/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj index fcbd96b..096431a 100644 --- a/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.70 + 0.0.0.71 core of database. EasyMicroservices@gmail.com core,cores,base,client,clients diff --git a/src/CSharp/EasyMicroservices.Cores.Contracts/Contracts/Requests/Multilingual/GetByLanguageRequestContract.cs b/src/CSharp/EasyMicroservices.Cores.Contracts/Contracts/Requests/Multilingual/GetByLanguageRequestContract.cs new file mode 100644 index 0000000..957334d --- /dev/null +++ b/src/CSharp/EasyMicroservices.Cores.Contracts/Contracts/Requests/Multilingual/GetByLanguageRequestContract.cs @@ -0,0 +1,22 @@ +namespace EasyMicroservices.Cores.Contracts.Requests.Multilingual; +/// +/// +/// +public class GetByLanguageRequestContract +{ + /// + /// + /// + public string LanguageShortName { get; set; } + /// + /// + /// + /// + public static implicit operator GetByLanguageRequestContract(string languageShortName) + { + return new GetByLanguageRequestContract() + { + LanguageShortName = languageShortName + }; + } +} diff --git a/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj b/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj index 3d3fa02..458b43d 100644 --- a/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net45;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.70 + 0.0.0.71 core contracts. EasyMicroservices@gmail.com core,cores,base,contract,contracts,dto,dtos diff --git a/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj b/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj index 9634af3..a3e44ca 100644 --- a/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net45;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.70 + 0.0.0.71 core of database. EasyMicroservices@gmail.com core,cores,base,database diff --git a/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj b/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj index b1a1dd9..59c918c 100644 --- a/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj +++ b/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj @@ -4,7 +4,7 @@ net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.70 + 0.0.0.71 ef core of database. EasyMicroservices@gmail.com core,cores,base,database,ef,efcore diff --git a/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj b/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj index 788d7a9..eb22226 100644 --- a/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj @@ -4,7 +4,7 @@ net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.70 + 0.0.0.71 ef core of Relational database. EasyMicroservices@gmail.com core,cores,base,database,ef,efcore,Relational