JSON.Net Self referencing loop detected

前端 未结 11 812
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 04:18

I have a mssql database for my website within 4 tables.

When I use this:

public static string GetAllEventsForJSON()
{
    using (CyberDBDataContext d         


        
11条回答
  •  北海茫月
    2020-11-28 05:02

    Add "[JsonIgnore]" to your model class

    {
      public Customer()
      {
        Orders = new Collection();
      }
    
    public int Id { get; set; }
    public string Name { get; set; }
    public string Surname { get; set; }
    
    [JsonIgnore]
    public ICollection Orders { get; set; }
    }
    

提交回复
热议问题