I have a function that I use to retrieve data via the entity framework.
public IEnumerable<Deal> GetCategory(int subcategoryId)
{
using (var uow = new ReadUow())
{
var r = new ReadRepo<Deal>(uow.Context);
var deals = r.FindBy()
.Include("DealSubcategories")
.Where(d => d.DealSubcategories.Any(s => s.SubcategoryId == subcategoryId));
return deals.ToList();
}
}
The .Where clause allows me to filter by a single subcategoryId (courtesy Lee and Jon Skeet), but I’m struggling similarly with comparing it to a list in a different query. So instead of a single subcategoryId, I would compare to a List somehow.
Pretty frustrating so any advice would be appreciated.
Assuming you had an
IEnumerable<int>called ids that contained the values you wanted to search for: