2015-04-17 96 views
0

的父母我使用的EntityFramework 6,代码优先和有一个这样的层次结构:LINQ - 让父母

一个产品分类 =>有许多产品 =>其中一个产品有很多ProductDetails

另一个实体“SalesOrderDetail”有一个属性“ProductDetail”。我在找的是一个linq查询,它获取属于一个ProductCategory的所有SalesOrderDetails。

TIA 海科

回答

1

这应该做的伎俩:

IEnumerable<SalesOrderDetail> result = orderDetails.Where(order => order.ProductDetail.Product.ProductCategory.Id == searchedProductCategoryId); 
+0

生活是那么容易......有时。 :-) – okieh