我意思是你在实体层的主外键关系上,增加[JsonIgnore]
如果你是ef生成的实体层。
比如 有2个类
public class A
{
public int id{get;set;}
public int bid{get;set;}
[JsonIgnore]
public B b{get;set;}
}
public class B
{
public int id{get;set;}
[JsonIgnore]
public ICollection<A> A{get;set;}
}
在上面的主外键关联处,都增加 [JsonIgnore] 标签。