Skip to content

Commit

Permalink
update packages and support for multiple add and update content resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-YousefiTelori committed Dec 16, 2023
1 parent cd07ca1 commit c9045d4
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0.19</Version>
<Version>0.0.0.20</Version>
<Description>client generated code.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>microservice,Content,Contents,client</PackageTags>
Expand All @@ -16,20 +16,20 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.Cores.Clients" Version="0.0.0.61" />
<PackageReference Include="EasyMicroservices.Cores.Clients" Version="*" />
<PackageReference Include="Microsoft.Extensions.ApiDescription.Client" Version="7.0.14">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NSwag.ApiDescription.Client" Version="13.20.0">
<PackageReference Include="Newtonsoft.Json" Version="*" />
<PackageReference Include="NSwag.ApiDescription.Client" Version="*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Net.Http" Version="*" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,22 @@ public Task<CategoryContractMessageContract> AddToContentLanguage(object item)
return SaveToContentLanguage(item, AddToContent);
}

/// <summary>
///
/// </summary>
/// <param name="items"></param>
/// <returns></returns>
public async Task<List<CategoryContractMessageContract>> AddToContentLanguage(IEnumerable items)
{
List<Task<CategoryContractMessageContract>> tasks = new List<Task<CategoryContractMessageContract>>();
foreach (var item in items)
{
tasks.Add(AddToContentLanguage(item));
}
await Task.WhenAll(tasks);
return tasks.Select(x => x.Result).ToList();
}

/// <summary>
///
/// </summary>
Expand All @@ -175,6 +191,21 @@ public Task<MessageContract> UpdateToContentLanguage(object item)
return SaveToContentLanguageUpdate(item, UpdateToContent);
}

/// <summary>
///
/// </summary>
/// <param name="items"></param>
/// <returns></returns>
public async Task UpdateToContentLanguage(IEnumerable items)
{
List<Task> tasks = new List<Task>();
foreach (var item in items)
{
tasks.Add(UpdateToContentLanguage(item));
}
await Task.WhenAll(tasks);
}

async Task<CategoryContractMessageContract> SaveToContentLanguage(object item, Func<(string UniqueIdentity, string Name, IEnumerable<LanguageDataContract> Languages)[], Task<CategoryContractMessageContract>> saveData)
{
if (item.Equals(default))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.Configuration" Version="0.0.0.2" />
<!--<PackageReference Include="EasyMicroservices.Cores.Relational.EntityFrameworkCore" Version="0.0.0.23" />-->
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.13" />
<PackageReference Include="EasyMicroservices.Configuration" Version="*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.14" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.Cores.AspEntityFrameworkCoreApi" Version="0.0.0.46" />
<PackageReference Include="EasyMicroservices.Cores.AspEntityFrameworkCoreApi" Version="*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.Mapper.CompileTimeMapper" Version="0.0.0.6" />
<PackageReference Include="EasyMicroservices.Mapper.SerializerMapper" Version="0.0.0.3" />
<PackageReference Include="EasyMicroservices.Serialization.Newtonsoft.Json" Version="0.0.0.6" />
<PackageReference Include="EasyMicroservices.Mapper.CompileTimeMapper" Version="*" />
<PackageReference Include="EasyMicroservices.Mapper.SerializerMapper" Version="*" />
<PackageReference Include="EasyMicroservices.Serialization.Newtonsoft.Json" Version="*" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.WhiteLabelsMicroservice.Clients" Version="0.0.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.13" />
<PackageReference Include="EasyMicroservices.WhiteLabelsMicroservice.Clients" Version="*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.14" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.ContentsMicroservice.Clients" Version="0.0.0.16" />
<PackageReference Include="EasyMicroservices.Tests" Version="0.0.0.9" />
<PackageReference Include="EasyMicroservices.ContentsMicroservice.Clients" Version="*" />
<PackageReference Include="EasyMicroservices.Tests" Version="*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.console" Version="2.6.1">
Expand All @@ -32,7 +32,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing">
<Version>7.0.13</Version>
<Version>7.0.14</Version>
</PackageReference>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.13">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.14">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="*" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Program
public static async Task Main(string[] args)
{
var app = CreateBuilder(args);
var build = await app.Build<ContentContext>(true);
var build = await app.BuildWithUseCors<ContentContext>(null, true);
build.MapControllers();
build.Run();
}
Expand All @@ -21,6 +21,7 @@ static WebApplicationBuilder CreateBuilder(string[] args)
app.Services.AddTransient((serviceProvider) => new UnitOfWork(serviceProvider));
app.Services.AddTransient(serviceProvider => new ContentContext(serviceProvider.GetService<IEntityFrameworkCoreDatabaseBuilder>()));
app.Services.AddTransient<IEntityFrameworkCoreDatabaseBuilder, DatabaseBuilder>();
StartUpExtensions.AddAuthentication("RootAddresses:Authentication");
StartUpExtensions.AddWhiteLabel("Content", "RootAddresses:WhiteLabel");
return app;
}
Expand Down

0 comments on commit c9045d4

Please sign in to comment.