If I want to append a AND statement to my query, I can do:
query = query.Where(obj=>obj.Id == id); if(name.HasValue) query = query.Where(obj=>obj.Na
Simply this if I'm not missing something:
query.Where(obj=>obj.Id == id || (obj.Name == name && name.HasValue))
You might want to read this question (my question...) and answer for more complicated scenarios: How to filter IEnumerable based on an entity input parameter