我有父母的孩子集合對象,並想知道如何從使用LINQLINQ的 - 從子集
父集合
Public Class FaultCodeModel
Public Property ID As Short
Public Property Description As String
Public Property FaultCodeDetails As List(Of FaultCodeDetailModel)
End Class
子集合
子集合得到一個單一的項目選擇單個項目Public Class FaultCodeDetailModel
Public Property ID As Short
Public Property Description As String
Public Property NotifyPurchasing As Boolean
Public Property NotifyPurchasingAfterHits As Short
Public Property NotifyExpediting As Boolean
Public Property NotifyExpeditingAfterHits As Short
Public Property NotifyBuyer As Boolean
Public Property NotifyBuyerAfterHits As Short
Public Property NotifySupplier As Boolean
Public Property NotifySupplierAfterHits As Short
Public Property NotiifyProPack As Boolean
Public Property NotiifyProPackAfterHits As Short
Public Property NotifyGoodsInTeamLeader As Boolean
Public Property NotifyGoodsInTeamLeaderAfterHits As Short
End Class
我已經嘗試了下面的Linq查詢,但它返回了父ID字段匹配的多個子項。
Dim var = From fcd In FaultCodes Where fcd.FaultCodeDetails.Any(Function(w) w.ID.Equals(faultCodeDetailID))
Select fcd.FaultCodeDetails
如何從子集合中獲取單個項目?
認爲這是缺少來自Any的右括號。它去哪裏? – 2012-01-12 11:52:35
謝謝蒂姆,明白了 – 2012-01-12 12:00:14