I have two Guid collections:
List<Guid> statuses;
List<Guid> priorities;
How to make the following query:
var result = context.Activity.Where(a =>
(a.StatusID == statuses[0] || a.StatusID == statuses[1] || ... || a.StatusID == statuses[n]) &&
(a.PriorityID == priorities[0] || a.PriorityID == priorities[1] || ... || a.PriorityID == priorities[m]))
Collections could be empty and in this case we shouldn't add an appropriate 'AND' condition. How to do such dynamic query?
UPDATE
Hmm, imagine I need something like this:
List<Func<Activity, bool>> conds = new List<Func<Activity, bool>>();
var result = context.Activity.Where(conds[0] || (conds[1] && conds[2]))
How to do that?