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
I would just build this into a single condition:
if (name.HasValue) query = query.Where(obj=>obj.Id == id && obj.Name == name); else query = query.Where(obj=>obj.Id == id);