我在linq查询中真的很新,我希望你们可以帮我解决这个问题
我有一个Product表和一个ProductCategory表
productCategory表是product表和类别表
之间的映射所以我需要从Product Table中获取所有产品,这些产品在productCategory表中具有某个类别ID的映射...例如,categoryId 5中的所有产品
我真的不确定Linq查询应该如何进行
答案 0 :(得分:0)
应该如此简单:
myContext.Products.Where(p => p.ProductCategory.CategoryID == 5);