mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-06 08:46:39 +00:00
JSonIgnore M2M joint
This commit is contained in:
parent
e4fe81a45c
commit
1af2d95e7a
2 changed files with 9 additions and 7 deletions
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace TicketManager.Models
|
||||
{
|
||||
|
|
@ -39,6 +40,7 @@ namespace TicketManager.Models
|
|||
[Display(Name = "Avatar")]
|
||||
public string Picture { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<Assignment> Assignments { get; set; } = new List<Assignment>();
|
||||
|
||||
[Display(Name = "Activity")]
|
||||
|
|
|
|||
14
Startup.cs
14
Startup.cs
|
|
@ -14,7 +14,7 @@ using Microsoft.EntityFrameworkCore;
|
|||
using Microsoft.OpenApi.Models;
|
||||
using Microsoft.AspNetCore.Mvc.NewtonsoftJson;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Newtonsoft.Json;
|
||||
// using Newtonsoft.Json;
|
||||
using TicketManager.Data;
|
||||
|
||||
[assembly: ApiController]
|
||||
|
|
@ -48,12 +48,12 @@ namespace TicketManager
|
|||
options.Audience = "https://localhost:5001/api/V1/";
|
||||
});
|
||||
|
||||
services.AddControllers()
|
||||
.AddNewtonsoftJson(options =>
|
||||
{
|
||||
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; // avoid cycle ref errors
|
||||
}
|
||||
);
|
||||
services.AddControllers();
|
||||
// .AddNewtonsoftJson(options =>
|
||||
// {
|
||||
// options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; // avoid cycle ref errors
|
||||
// }
|
||||
// );
|
||||
|
||||
services.AddSpaStaticFiles(configuration =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue