Skip to content

Commit

Permalink
Merge pull request #101 from aspnetboilerplate/System.Text.Json
Browse files Browse the repository at this point in the history
Using `System.Text.Json` to replace `Newtonsoft`.
  • Loading branch information
ismcagdas authored Jan 25, 2024
2 parents d34557a + e5f7f1e commit 9d56a24
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 19 deletions.
7 changes: 7 additions & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="ABP Nightly Source" value="https://www.myget.org/F/abp-nightly/api/v3/index.json" />
</packageSources>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Abp.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Abp.AutoMapper" Version="9.0.0" />
<PackageReference Include="Abp.EntityFrameworkCore" Version="9.1.0-preview20240125" />
<PackageReference Include="Abp.AutoMapper" Version="9.1.0-preview20240125" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Abp" Version="9.0.0" />
<PackageReference Include="Abp" Version="9.1.0-preview20240125" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Abp.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Abp.EntityFrameworkCore" Version="9.1.0-preview20240125" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" />
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="Abp.AspNetCore" Version="9.0.0" />
<PackageReference Include="Abp.Castle.Log4Net" Version="9.0.0" />
<PackageReference Include="Abp.AspNetCore" Version="9.1.0-preview20240125" />
<PackageReference Include="Abp.Castle.Log4Net" Version="9.1.0-preview20240125" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/AbpCompanyName.AbpProjectName.Web/Startup/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ namespace AbpCompanyName.AbpProjectName.Web.Startup
{
public class Startup
{

private readonly IWebHostEnvironment _hostingEnvironment;

public Startup(IWebHostEnvironment env)
{
_hostingEnvironment = env;
}

public IServiceProvider ConfigureServices(IServiceCollection services)
{
//Configure DbContext
Expand All @@ -34,7 +34,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
services.AddControllersWithViews(options =>
{
options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
}).AddNewtonsoftJson();
});

//Configure Abp and Dependency Injection
return services.AddAbp<AbpProjectNameWebModule>(options =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="Abp.TestBase" Version="9.0.0" />
<PackageReference Include="Abp.TestBase" Version="9.1.0-preview20240125" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="Castle.Windsor.MsDependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Abp.AspNetCore.TestBase" Version="9.0.0" />
<PackageReference Include="Abp.AspNetCore.TestBase" Version="9.1.0-preview20240125" />
<PackageReference Include="AngleSharp" Version="1.0.7" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
using System;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Text.Json;
using System.Threading.Tasks;
using Abp.AspNetCore.TestBase;
using AbpCompanyName.AbpProjectName.EntityFrameworkCore;
using AbpCompanyName.AbpProjectName.Tests.TestDatas;
using AbpCompanyName.AbpProjectName.Web.Controllers;
using AbpCompanyName.AbpProjectName.Web.Startup;
using AbpCompanyName.AbpProjectName.Web.Tests.Controllers;
using AngleSharp.Html.Dom;
using AngleSharp.Html.Parser;
using Microsoft.AspNetCore.Hosting;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Shouldly;

namespace AbpCompanyName.AbpProjectName.Web.Tests
Expand Down Expand Up @@ -46,9 +42,9 @@ protected async Task<T> GetResponseAsObjectAsync<T>(string url,
HttpStatusCode expectedStatusCode = HttpStatusCode.OK)
{
var strResponse = await GetResponseAsStringAsync(url, expectedStatusCode);
return JsonConvert.DeserializeObject<T>(strResponse, new JsonSerializerSettings
return JsonSerializer.Deserialize<T>(strResponse, new JsonSerializerOptions()
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
});
}

Expand Down Expand Up @@ -126,4 +122,4 @@ protected IHtmlDocument ParseHtml(string htmlString)

#endregion
}
}
}

0 comments on commit 9d56a24

Please sign in to comment.