diff options
| author | crupest <crupest@outlook.com> | 2022-12-02 13:23:40 +0800 | 
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2022-12-02 13:35:35 +0800 | 
| commit | f0e48b2957d2ff8d66bb8d8a0cec673f8b424558 (patch) | |
| tree | 59f4e3942cc35664993f8bb8b9e4f7bf2ff4f3a3 /docker | |
| parent | 300842e81a99db6da103f146d33eb47f43efc683 (diff) | |
| download | crupest-f0e48b2957d2ff8d66bb8d8a0cec673f8b424558.tar.gz crupest-f0e48b2957d2ff8d66bb8d8a0cec673f8b424558.tar.bz2 crupest-f0e48b2957d2ff8d66bb8d8a0cec673f8b424558.zip  | |
Fix crupest-api bug.
Diffstat (limited to 'docker')
6 files changed, 20 insertions, 16 deletions
diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Commons/CrupestApi.Commons.csproj b/docker/crupest-api/CrupestApi/CrupestApi.Commons/CrupestApi.Commons.csproj index 72a1294..c0cd0c4 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Commons/CrupestApi.Commons.csproj +++ b/docker/crupest-api/CrupestApi/CrupestApi.Commons/CrupestApi.Commons.csproj @@ -2,6 +2,7 @@    <PropertyGroup>
      <TargetFramework>net7.0</TargetFramework>
 +    <TargetType>library</TargetType>
      <Nullable>enable</Nullable>
      <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>
 diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Json.cs b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Json.cs index 0ec3ff0..8409a96 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Json.cs +++ b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Json.cs @@ -1,9 +1,8 @@ -using System.Text;  using System.Text.Json; +using Microsoft.Extensions.Options;  namespace CrupestApi.Commons; -  public static class CrupestApiJsonExtensions  {      public static IServiceCollection AddJsonOptions(this IServiceCollection services) @@ -22,8 +21,8 @@ public static class CrupestApiJsonExtensions      public static async Task WriteJsonAsync<T>(this HttpResponse response, T bodyObject, int statusCode = 200, HttpResponseAction? beforeWriteBody = null, CancellationToken cancellationToken = default)      { -        var jsonOptions = response.HttpContext.RequestServices.GetRequiredService<JsonSerializerOptions>(); -        byte[] json = JsonSerializer.SerializeToUtf8Bytes<T>(bodyObject, jsonOptions); +        var jsonOptions = response.HttpContext.RequestServices.GetRequiredService<IOptionsSnapshot<JsonSerializerOptions>>(); +        byte[] json = JsonSerializer.SerializeToUtf8Bytes<T>(bodyObject, jsonOptions.Value);          var byteCount = json.Length;          response.StatusCode = statusCode; diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Files/CrupestApi.Files.csproj b/docker/crupest-api/CrupestApi/CrupestApi.Files/CrupestApi.Files.csproj index 2d78adb..bb98ece 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Files/CrupestApi.Files.csproj +++ b/docker/crupest-api/CrupestApi/CrupestApi.Files/CrupestApi.Files.csproj @@ -1,11 +1,12 @@  <Project Sdk="Microsoft.NET.Sdk.Web">
 -  <ItemGroup> -    <ProjectReference Include="..\CrupestApi.Commons\CrupestApi.Commons.csproj" /> +  <ItemGroup>
 +    <ProjectReference Include="..\CrupestApi.Commons\CrupestApi.Commons.csproj" />
    </ItemGroup>
    <PropertyGroup>
      <TargetFramework>net7.0</TargetFramework>
 +    <TargetType>library</TargetType>
      <Nullable>enable</Nullable>
      <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>
 diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Secrets/CrupestApi.Secrets.csproj b/docker/crupest-api/CrupestApi/CrupestApi.Secrets/CrupestApi.Secrets.csproj index 2d78adb..bb98ece 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Secrets/CrupestApi.Secrets.csproj +++ b/docker/crupest-api/CrupestApi/CrupestApi.Secrets/CrupestApi.Secrets.csproj @@ -1,11 +1,12 @@  <Project Sdk="Microsoft.NET.Sdk.Web">
 -  <ItemGroup> -    <ProjectReference Include="..\CrupestApi.Commons\CrupestApi.Commons.csproj" /> +  <ItemGroup>
 +    <ProjectReference Include="..\CrupestApi.Commons\CrupestApi.Commons.csproj" />
    </ItemGroup>
    <PropertyGroup>
      <TargetFramework>net7.0</TargetFramework>
 +    <TargetType>library</TargetType>
      <Nullable>enable</Nullable>
      <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>
 diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Todos/CrupestApi.Todos.csproj b/docker/crupest-api/CrupestApi/CrupestApi.Todos/CrupestApi.Todos.csproj index 2d78adb..bb98ece 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Todos/CrupestApi.Todos.csproj +++ b/docker/crupest-api/CrupestApi/CrupestApi.Todos/CrupestApi.Todos.csproj @@ -1,11 +1,12 @@  <Project Sdk="Microsoft.NET.Sdk.Web">
 -  <ItemGroup> -    <ProjectReference Include="..\CrupestApi.Commons\CrupestApi.Commons.csproj" /> +  <ItemGroup>
 +    <ProjectReference Include="..\CrupestApi.Commons\CrupestApi.Commons.csproj" />
    </ItemGroup>
    <PropertyGroup>
      <TargetFramework>net7.0</TargetFramework>
 +    <TargetType>library</TargetType>
      <Nullable>enable</Nullable>
      <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>
 diff --git a/docker/crupest-api/CrupestApi/CrupestApi/CrupestApi.csproj b/docker/crupest-api/CrupestApi/CrupestApi/CrupestApi.csproj index c408c7d..0ab7169 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi/CrupestApi.csproj +++ b/docker/crupest-api/CrupestApi/CrupestApi/CrupestApi.csproj @@ -1,16 +1,17 @@  <Project Sdk="Microsoft.NET.Sdk.Web">
 -  <ItemGroup> -    <ProjectReference Include="..\CrupestApi.Todos\CrupestApi.Todos.csproj" /> -    <ProjectReference Include="..\CrupestApi.Files\CrupestApi.Files.csproj" /> -    <ProjectReference Include="..\CrupestApi.Commons\CrupestApi.Commons.csproj" /> -    <ProjectReference Include="..\CrupestApi.Secrets\CrupestApi.Secrets.csproj" /> +  <ItemGroup>
 +    <ProjectReference Include="..\CrupestApi.Todos\CrupestApi.Todos.csproj" />
 +    <ProjectReference Include="..\CrupestApi.Files\CrupestApi.Files.csproj" />
 +    <ProjectReference Include="..\CrupestApi.Commons\CrupestApi.Commons.csproj" />
 +    <ProjectReference Include="..\CrupestApi.Secrets\CrupestApi.Secrets.csproj" />
    </ItemGroup>
    <PropertyGroup>
      <TargetFramework>net7.0</TargetFramework>
 +    <TargetType>exe</TargetType>
      <Nullable>enable</Nullable>
      <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>
 -</Project>
 +</Project>
\ No newline at end of file  | 
