我有以下按需执行“AND”的查询:
var products = // Selecting a list of products in anywhere based in a filter...
foreach (var product in products)
{
query = query.Where(p => p.Code == product.Code); // with this way, this query make no sense because this happens in any scenario, never a code can be more than one code.
}
那么,我怎样才能执行相同的查询但按需执行“OR”(以便查询有意义)?