mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-10 02:36:39 +00:00
switch to Newtonsoft.Json and config ti avoid cycle errors
This commit is contained in:
parent
ec9e31171e
commit
2f03b8f402
5 changed files with 14 additions and 4 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -4,4 +4,5 @@ obj/
|
|||
.vscode/
|
||||
Migrations/
|
||||
app.db
|
||||
client/node_modules
|
||||
client/node_modules
|
||||
Scripts/
|
||||
|
|
@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
|||
using TicketManager.Data;
|
||||
using TicketManager.Models;
|
||||
|
||||
|
||||
namespace TicketManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ namespace TicketManager.Models
|
|||
|
||||
public User Creator { get; set; }
|
||||
public Guid CreatorId { get; set; }
|
||||
// public Project Project { get; set; }
|
||||
// public int ProjectId { get; set; }
|
||||
public Project Project { get; set; }
|
||||
public int ProjectId { get; set; }
|
||||
private List<Note> _notes;
|
||||
public List<Note> Notes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ using System.Reflection;
|
|||
using System.IO;
|
||||
using TicketManager.Data;
|
||||
using TicketManager.Models;
|
||||
using Microsoft.AspNetCore.Mvc.NewtonsoftJson;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TicketManager
|
||||
{
|
||||
|
|
@ -34,7 +36,12 @@ namespace TicketManager
|
|||
{
|
||||
services.AddDbContext<AppDbContext>(options =>
|
||||
options.UseSqlite(Configuration.GetConnectionString("Sqlite")));
|
||||
services.AddControllers();
|
||||
services.AddControllers()
|
||||
.AddNewtonsoftJson(options =>
|
||||
{
|
||||
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; // avoid cycle ref errors
|
||||
});
|
||||
|
||||
services.AddSpaStaticFiles(configuration =>
|
||||
{
|
||||
configuration.RootPath = "client/build";
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0">
|
||||
|
|
|
|||
Loading…
Reference in a new issue