Skip to content

Commit

Permalink
Merge pull request #68 from Ali-YousefiTelori/develop
Browse files Browse the repository at this point in the history
add if for whitelabel config
  • Loading branch information
Ali-YousefiTelori authored Oct 26, 2023
2 parents 14a3e8b + ca315b1 commit 35419bc
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.AuthenticationsMicroservice.VirtualServerForTests" Version="0.0.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.12" />
<PackageReference Include="EasyMicroservices.AuthenticationsMicroservice.VirtualServerForTests" Version="0.0.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.13" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -26,7 +26,7 @@

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing">
<Version>7.0.12</Version>
<Version>7.0.13</Version>
</PackageReference>
</ItemGroup>

Expand Down
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.41</Version>
<Version>0.0.0.42</Version>
<Description>asp core servces.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,services,asp,aspnet</PackageTags>
Expand Down
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.41</Version>
<Version>0.0.0.42</Version>
<Description>asp core servces.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,services,asp,aspnet,aspcore,efcore</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Linq;
using System.Net;
using System.Net.Mime;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

Expand Down Expand Up @@ -109,8 +110,11 @@ public static async Task Build<TContext>(this IApplicationBuilder app)
var dbbuilder = new DatabaseCreator();
using var context = scope.ServiceProvider.GetRequiredService<TContext>();
dbbuilder.Initialize(context);
using var uow = scope.ServiceProvider.GetRequiredService<IUnitOfWork>() as UnitOfWork;
await uow.Initialize(MicroserviceName, config.GetValue<string>(ConfigName), typeof(TContext)).ConfigureAwait(false);
if (WhiteLabelRoute.HasValue() || ConfigName.HasValue())
{
using var uow = scope.ServiceProvider.GetRequiredService<IUnitOfWork>() as UnitOfWork;
await uow.Initialize(MicroserviceName, config.GetValue<string>(ConfigName), typeof(TContext)).ConfigureAwait(false);
}
}
var build = app.Build();
app.Run(build);
Expand Down Expand Up @@ -179,7 +183,11 @@ public static async Task<WebApplication> Build<TContext>(this WebApplicationBuil
using var context = scope.ServiceProvider.GetRequiredService<TContext>();
dbbuilder.Initialize(context);
using var uow = scope.ServiceProvider.GetRequiredService<IUnitOfWork>() as UnitOfWork;
await uow.Initialize(MicroserviceName, WhiteLabelRoute ?? config.GetValue<string>(ConfigName), typeof(TContext)).ConfigureAwait(false);
if (WhiteLabelRoute.HasValue() || ConfigName.HasValue())
{
var value = WhiteLabelRoute ?? config.GetValue<string>(ConfigName);
await uow.Initialize(MicroserviceName, WhiteLabelRoute ?? config.GetValue<string>(ConfigName), typeof(TContext)).ConfigureAwait(false);
}
}
return build;
}
Expand Down
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.41</Version>
<Version>0.0.0.42</Version>
<Description>core contracts.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,contract,contracts,dto,dtos</PackageTags>
Expand Down
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.41</Version>
<Version>0.0.0.42</Version>
<Description>core of database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database</PackageTags>
Expand Down
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.41</Version>
<Version>0.0.0.42</Version>
<Description>ef core of database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,ef,efcore</PackageTags>
Expand Down
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.41</Version>
<Version>0.0.0.42</Version>
<Description>ef core of Relational database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,ef,efcore,Relational</PackageTags>
Expand All @@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.13" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.Laboratory" Version="0.0.0.14" />
<PackageReference Include="EasyMicroservices.Laboratory" Version="0.0.0.15" />
<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.Tests" Version="0.0.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.13" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="EasyMicroservices.WhiteLabelsMicroservice.VirtualServerForTests" Version="0.0.0.4" />
<PackageReference Include="EasyMicroservices.WhiteLabelsMicroservice.VirtualServerForTests" Version="0.0.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 35419bc

Please sign in to comment.