【发布时间】:2017-12-18 14:45:32
【问题描述】:
我正在通过 web api 返回数据。
FMSEntities db = new FMSEntities();
db.Voucher_BankReceipt.Include(x => x.Status)
status 是父表,它引用下面哈希集中给出的其他子表..
public Status()
{
this.Voucher_BankPayment = new HashSet<Voucher_BankPayment>();
this.Voucher_BankReceipt = new HashSet<Voucher_BankReceipt>();
this.Voucher_CashPayment = new HashSet<Voucher_CashPayment>();
this.Voucher_CashReceipt = new HashSet<Voucher_CashReceipt>();
this.Voucher_Journal = new HashSet<Voucher_Journal>();
this.Voucher_Log = new HashSet<Voucher_Log>();
this.Voucher_Workflow = new HashSet<Voucher_Workflow>();
}
在包含父表状态时,它包含所有引用的哈希集对象。如何避免重新加载 Voucher_BankReceipt 和其他 hashset json?
【问题讨论】:
-
像往常一样:关闭延迟加载。但答案中的选项更可取。
-
我的回答满足你的问题了吗?如果是,请考虑接受。
标签: json entity-framework asp.net-web-api