Often query expressions depend on runtime user input or program state. For example in one instance you may need to query by FirstName while in another instance you need to query by both FirstName and Age. Dynamic runtime queries can be created using a dynamic filtering expression which is passed to the Siaqodb engine as shown in the following example:

int val = DateTime.Now.Second % 2;
// declare predicate
Expression<Func<Employee, bool>> predicate = null;
if (val == 1)
    // build a predicate to filter only by FirstName
    predicate = employee => employee.FirstName.Contains("Emp");
    Log("Predicate with only FirstName is activated");
else if (val == 0)
    // build a predicate to filter by FirstName and Age
    predicate = employee => employee.FirstName.Contains("Emp") && employee.Age > 20;
    Log("Predicate with FirstName and Age is activated");
var q = siaqodb.Cast<Employee>().Where(predicate).Select(e => e);