diff --git a/Directory.Build.props b/Directory.Build.props index 06c257a..b76cded 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -30,13 +30,13 @@ - - - + + + - + diff --git a/samples/Samples.Tests/Samples.Tests.csproj b/samples/Samples.Tests/Samples.Tests.csproj index 4a39eef..d6f242d 100644 --- a/samples/Samples.Tests/Samples.Tests.csproj +++ b/samples/Samples.Tests/Samples.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 diff --git a/samples/Samples/Domain/JsonPlaceHolderHttpClient.cs b/samples/Samples/Domain/JsonPlaceHolderHttpClient.cs index 1878364..d4685e5 100644 --- a/samples/Samples/Domain/JsonPlaceHolderHttpClient.cs +++ b/samples/Samples/Domain/JsonPlaceHolderHttpClient.cs @@ -1,9 +1,9 @@ using System; using System.Net; using System.Net.Http; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; -using Newtonsoft.Json; namespace Samples.Domain { @@ -20,17 +20,14 @@ public JsonPlaceHolderHttpClient(HttpClient httpClient) public async Task GetAsync(string requestUri, CancellationToken cancellationToken = default) { var response = await _httpClient.GetAsync(requestUri, cancellationToken); - var content = await response.Content.ReadAsStringAsync(); - return JsonConvert.DeserializeObject(content); + return await JsonSerializer.DeserializeAsync(await response.Content.ReadAsStreamAsync(cancellationToken), new(JsonSerializerDefaults.Web), cancellationToken); } -#pragma warning disable CA1822 // Mark members as static #pragma warning disable CA1801 // Review unused parameters #pragma warning disable IDE0060 // Remove unused parameter public Task PostAsync(string requestUri, T data, CancellationToken cancellationToken = default) => #pragma warning restore IDE0060 // Remove unused parameter #pragma warning restore CA1801 // Review unused parameters -#pragma warning restore CA1822 // Mark members as static Task.FromResult(new HttpResponseMessage(HttpStatusCode.NoContent)); } } diff --git a/samples/Samples/Program.cs b/samples/Samples/Program.cs index 3e5007c..9a8d7c9 100644 --- a/samples/Samples/Program.cs +++ b/samples/Samples/Program.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; namespace Samples @@ -7,8 +7,6 @@ public sealed class Program { public static void Main(string[] args) => CreateWebHostBuilder(args).Build().Run(); - public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup(); + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args).UseStartup(); } } diff --git a/samples/Samples/Samples.csproj b/samples/Samples/Samples.csproj index 37cd058..b4eac88 100644 --- a/samples/Samples/Samples.csproj +++ b/samples/Samples/Samples.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 $(NoWarn);CA1054;CA1062;CA1819;CA2007;CA2234 @@ -12,7 +12,7 @@ - + diff --git a/src/Magneto/Magneto.csproj b/src/Magneto/Magneto.csproj index 8433eb3..2f9af7f 100644 --- a/src/Magneto/Magneto.csproj +++ b/src/Magneto/Magneto.csproj @@ -1,4 +1,4 @@ - + netstandard2.0;net461 @@ -10,9 +10,9 @@ - - - + + + diff --git a/test/Magneto.Tests/Magneto.Tests.csproj b/test/Magneto.Tests/Magneto.Tests.csproj index 820d37b..a9e6e4d 100644 --- a/test/Magneto.Tests/Magneto.Tests.csproj +++ b/test/Magneto.Tests/Magneto.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0