Q:

How to perform a dynamic query with Linq

I am trying to perform a dynamic OR. For example:
test = test.Where(z => z.Id > 1);
test = test.Where(x => x.Name == "Admin"); //or name equals admin

I am going to pass the first query through a method then need to perform and OR instead of an and. How do I do this with Linq?

A:

You can use union for OR effect.
    test1 = test.Where(z => z.Id > 1);
    test2 = test.Where(x => x.Name == "Admin"); //or name equals admin

    test = test1.Union(test2)

