通过ef查询关联数据后,出现无限循环情况,在实体中将属性加上[Newtonsoft.Json.JsonIgnore] [IgnoreDataMember]  就ok了。

我是查询后,用json转换,json不识别。

public class Category   
 {  
     public int Id { get; set; }   
     public string Name { get; set; }   
       
     [Newtonsoft.Json.JsonIgnore]   
     [IgnoreDataMember]  
     public virtual ICollection<Product> Products { get; set; }   
} 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2021-10-21
  • 2021-09-02
  • 2021-08-28
猜你喜欢
  • 2021-05-08
  • 2022-01-05
  • 2022-12-23
  • 2021-08-26
  • 2021-09-09
  • 2021-10-09
相关资源
相似解决方案