我正在寻找一种方法来对 linq 中的子集合进行 IN 子句查询。
我有一个例子如下:
Entity: Product.CategoryAssignments - this is an IList<Category> that the product is assigned to. Product can be assigned to multiple categories.
我想检索类别列表中匹配的所有产品,即
IList<Category> selectedCategories = GetUsersSelectedCategories();
// 如何做类似的事情
IList<Products> products = from p in repository where p.CategoryAssignments.Contains(?) select p;
任何提示赞赏?