diff options
Diffstat (limited to 'docker/crupest-api/CrupestApi')
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 |