From c9045d4b7cec7e4ca9ba02df99bdfb90a4c53aea Mon Sep 17 00:00:00 2001 From: Ali Yousefi Date: Sat, 16 Dec 2023 22:54:53 +0330 Subject: [PATCH] update packages and support for multiple add and update content resolver --- ...rvices.ContentsMicroservice.Clients.csproj | 10 +++--- .../Helpers/ContentLanguageHelper.cs | 31 +++++++++++++++++++ ...vices.ContentsMicroservice.Database.csproj | 5 ++- ...ervices.ContentsMicroservice.Domain.csproj | 2 +- ...ervices.ContentsMicroservice.Logics.csproj | 6 ++-- .../DatabaseBuilder.cs | 4 +-- ...rvices.ContentsMicroservice.StartUp.csproj | 4 +-- ...services.ContentsMicroservice.Tests.csproj | 6 ++-- ...ervices.ContentsMicroservice.WebApi.csproj | 4 +-- .../Program.cs | 3 +- 10 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/EasyMicroservices.ContentsMicroservice.Clients.csproj b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/EasyMicroservices.ContentsMicroservice.Clients.csproj index 6167344..ce45627 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/EasyMicroservices.ContentsMicroservice.Clients.csproj +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/EasyMicroservices.ContentsMicroservice.Clients.csproj @@ -5,7 +5,7 @@ AnyCPU;x64;x86 EasyMicroservices true - 0.0.0.19 + 0.0.0.20 client generated code. EasyMicroservices@gmail.com microservice,Content,Contents,client @@ -16,13 +16,13 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -30,6 +30,6 @@ - + diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Helpers/ContentLanguageHelper.cs b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Helpers/ContentLanguageHelper.cs index 5ba241f..f06d21a 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Helpers/ContentLanguageHelper.cs +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Helpers/ContentLanguageHelper.cs @@ -165,6 +165,22 @@ public Task AddToContentLanguage(object item) return SaveToContentLanguage(item, AddToContent); } + /// + /// + /// + /// + /// + public async Task> AddToContentLanguage(IEnumerable items) + { + List> tasks = new List>(); + foreach (var item in items) + { + tasks.Add(AddToContentLanguage(item)); + } + await Task.WhenAll(tasks); + return tasks.Select(x => x.Result).ToList(); + } + /// /// /// @@ -175,6 +191,21 @@ public Task UpdateToContentLanguage(object item) return SaveToContentLanguageUpdate(item, UpdateToContent); } + /// + /// + /// + /// + /// + public async Task UpdateToContentLanguage(IEnumerable items) + { + List tasks = new List(); + foreach (var item in items) + { + tasks.Add(UpdateToContentLanguage(item)); + } + await Task.WhenAll(tasks); + } + async Task SaveToContentLanguage(object item, Func<(string UniqueIdentity, string Name, IEnumerable Languages)[], Task> saveData) { if (item.Equals(default)) diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.Database/EasyMicroservices.ContentsMicroservice.Database.csproj b/src/CSharp/EasyMicroservices.ContentsMicroservice.Database/EasyMicroservices.ContentsMicroservice.Database.csproj index e117fe9..0621a7f 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.Database/EasyMicroservices.ContentsMicroservice.Database.csproj +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.Database/EasyMicroservices.ContentsMicroservice.Database.csproj @@ -11,9 +11,8 @@ - - - + + diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.Domain/EasyMicroservices.ContentsMicroservice.Domain.csproj b/src/CSharp/EasyMicroservices.ContentsMicroservice.Domain/EasyMicroservices.ContentsMicroservice.Domain.csproj index 2c80675..8e26d98 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.Domain/EasyMicroservices.ContentsMicroservice.Domain.csproj +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.Domain/EasyMicroservices.ContentsMicroservice.Domain.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.Logics/EasyMicroservices.ContentsMicroservice.Logics.csproj b/src/CSharp/EasyMicroservices.ContentsMicroservice.Logics/EasyMicroservices.ContentsMicroservice.Logics.csproj index 7f6f97c..87a4d0c 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.Logics/EasyMicroservices.ContentsMicroservice.Logics.csproj +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.Logics/EasyMicroservices.ContentsMicroservice.Logics.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/DatabaseBuilder.cs b/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/DatabaseBuilder.cs index 1a4d081..28d0aee 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/DatabaseBuilder.cs +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/DatabaseBuilder.cs @@ -20,8 +20,8 @@ public DatabaseBuilder(IConfiguration configuration) public void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - //optionsBuilder.UseInMemoryDatabase("ContentDatabase"); - optionsBuilder.UseSqlServer(_configuration.GetConnectionString("local")); + optionsBuilder.UseInMemoryDatabase("ContentDatabase"); + //optionsBuilder.UseSqlServer(_configuration.GetConnectionString("local")); } } } diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/EasyMicroservices.ContentsMicroservice.StartUp.csproj b/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/EasyMicroservices.ContentsMicroservice.StartUp.csproj index c9e2c30..52d2312 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/EasyMicroservices.ContentsMicroservice.StartUp.csproj +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/EasyMicroservices.ContentsMicroservice.StartUp.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.Tests/EasyMicroservices.ContentsMicroservice.Tests.csproj b/src/CSharp/EasyMicroservices.ContentsMicroservice.Tests/EasyMicroservices.ContentsMicroservice.Tests.csproj index ef293a4..e7251b6 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.Tests/EasyMicroservices.ContentsMicroservice.Tests.csproj +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.Tests/EasyMicroservices.ContentsMicroservice.Tests.csproj @@ -19,8 +19,8 @@ - - + + @@ -32,7 +32,7 @@ all - 7.0.13 + 7.0.14 diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/EasyMicroservices.ContentsMicroservice.WebApi.csproj b/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/EasyMicroservices.ContentsMicroservice.WebApi.csproj index 96e3df0..af0adea 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/EasyMicroservices.ContentsMicroservice.WebApi.csproj +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/EasyMicroservices.ContentsMicroservice.WebApi.csproj @@ -6,11 +6,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Program.cs b/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Program.cs index 6749558..1094303 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Program.cs +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Program.cs @@ -9,7 +9,7 @@ public class Program public static async Task Main(string[] args) { var app = CreateBuilder(args); - var build = await app.Build(true); + var build = await app.BuildWithUseCors(null, true); build.MapControllers(); build.Run(); } @@ -21,6 +21,7 @@ static WebApplicationBuilder CreateBuilder(string[] args) app.Services.AddTransient((serviceProvider) => new UnitOfWork(serviceProvider)); app.Services.AddTransient(serviceProvider => new ContentContext(serviceProvider.GetService())); app.Services.AddTransient(); + StartUpExtensions.AddAuthentication("RootAddresses:Authentication"); StartUpExtensions.AddWhiteLabel("Content", "RootAddresses:WhiteLabel"); return app; }