我有父母的孩子集合对象,并想知道如何从使用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