Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update core strucutre #41

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.21</Version>
<Version>0.0.0.22</Version>
<Description>client generated code.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>microservice,Content,Contents,client</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,14 @@ public Task<CategoryContractMessageContract> AddToContentLanguage(object item)
/// </summary>
/// <param name="items"></param>
/// <returns></returns>
public async Task<List<CategoryContractMessageContract>> AddToContentLanguage(IEnumerable items)
public Task<List<Task<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();
return Task.FromResult(tasks);
}

/// <summary>
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.70" />
<PackageReference Include="EasyMicroservices.Cores.AspEntityFrameworkCoreApi" Version="0.0.0.76" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ public DatabaseBuilder(IConfiguration configuration) : base(configuration)
{
}

public override void OnConfiguring(DbContextOptionsBuilder optionsBuilder, string name)
public override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (name == "SqlServer")
optionsBuilder.UseSqlServer(Configuration.GetConnectionString("local"));
else
var entity = GetEntity();
if (entity.IsSqlServer())
optionsBuilder.UseSqlServer(entity.ConnectionString);
else if (entity.IsInMemory())
optionsBuilder.UseInMemoryDatabase("Contents");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.WhiteLabelsMicroservice.Clients" Version="*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.14" />
<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,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.ContentsMicroservice.Clients" Version="0.0.0.20" />
<PackageReference Include="EasyMicroservices.ContentsMicroservice.Clients" Version="0.0.0.21" />
<PackageReference Include="EasyMicroservices.Tests" Version="*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@
<Content Update="appsettings.$(MSBuildThisFileName).json" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>


<ItemGroup>
<Content Update="web.config" CopyToPublishDirectory="Never" />
<Content Update="appsettings.json" CopyToPublishDirectory="Never" />
<Content Update="appsettings.*.json" CopyToPublishDirectory="Never" />
<Content Update="appsettings.$(MSBuildThisFileName).json" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ public static async Task Main(string[] args)
static WebApplicationBuilder CreateBuilder(string[] args)
{
var app = StartUpExtensions.Create<ContentContext>(args);
app.Services.Builder<ContentContext>();
app.Services.Builder<ContentContext>("Content");
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,33 @@
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"local": "Server=.;Database=Contents;User ID=TrustServerCertificate=True;"
},
"Database": {
"ProviderName": "InMemory"
},
"Databases": [
{
"Name": "Entity",
"ProviderName": "InMemory",
"ConnectionString": "Server=.;Database=Contents;Integrated Security=True;Trusted_Connection=True;TrustServerCertificate=True"
}
],
"ServiceAddresses": [
{
"Name": "Authentication",
"Address": "http://localhost:1044",
"Databases": null
},
{
"Name": "WhiteLabel",
"Address": "http://localhost:1041",
"Databases": null
}
],
"Authorization": {
"Use": false,
"Use": true,
"JWT": {
"Key": "VGhpc0lzGHGHGHlY3JldEtleUZvckp3dEF1dGhlbnRpY2F0aW9u=",
"Issuer": "https://github.com/easymicroservices",
"Audience": "easymicroservices",

"TokenExpireTimeInSeconds": 86400
}
},
"RootAddresses": {
"WhiteLabel": "http://localhost:1041",
"Authentication": "http://localhost:1044"
},
"Urls": "http://*:2003"
}
Loading