EFクエリでネストされたJSON応答を取得したいのですが、これを行う方法がわかりません。モデルを次のように宣言しました。
[Serializable]
public class StockReturnMethod
{
public int WarehouseID { get; set; }
public int ProductSKUID { get; set; }
public int LotID { get; set; }
public string LotName { get; set; }
public int AreaID { get; set; }
public string AreaName { get; set; }
public int BinID { get; set; }
public string BinName { get; set; }
public List<AvailibleStock> Stock { get; set; }
}
[Serializable]
public class AvailibleStock
{
public int WarehouseID { get; set; }
public int ProductSKUID { get; set; }
public string ProductSKUName { get; set; }
public string WarehouseName { get; set; }
public string Status { get; set; }
public int QtyUnassigned { get; set; }
}
これが私がこれまでに持っている私のEFクエリです。
{
return (from WH in SCMENT.Warehouses
join WL in SCMENT.WarehouseLots on WH.WarehouseID equals WL.WarehouseID
join WA in SCMENT.WarehouseAreas on WL.WarehouseLotID equals WA.WarehouseLotID
join WB in SCMENT.WarehouseBins on WA.WarehouseAreaID equals WB.WarehouseAreaID
join SLI in SCMENT.StockLineItems on WH.WarehouseID equals SLI.WarehouseID
join PSKU in SCMENT.ProductSKUs on SLI.ProductSKUID equals PSKU.ProductSKUID
where SLI.SystemAreaID == 1
select new StockReturnMethod()
{
WarehouseID = WH.WarehouseID,
LotID = WL.WarehouseLotID,
LotName = WL.WarehouseLotName,
AreaID = WA.WarehouseAreaID,
AreaName = WA.WarehouseAreaName,
BinID = WB.WarehouseBinID,
BinName = WB.WarehouseBinName,
ProductSKUID = PSKU.ProductSKUID,
Stock = (Will I create a sub query here?)
}
)