EDIT: Is it possible to pass in a string for the RelationPredicateBucket to parse? That would make incremental construction of the predicate expression much easier.
Why would you want to do that??????
That would totally defeat the concept of typed, compile-time checked queries without adding ANY value.
Let's have a look at this filter :
Workbooks.EmployerId = 6 AND (Workbooks.Inactive = 1 OR Workbooks.ExpiryDate < DateTime.Today)
You notice that there are two expressions in it :
1) Workbooks.EmployerId = 6
2) (Workbooks.Inactive = 1 OR Workbooks.ExpiryDate < DateTime.Today)
You first declare a RelationPredicateBucket :
RelationPredicateBucket filter = new RelationPredicateBucket();
Now let's declare the first expression :
PredicateExpression expr1 = new PredicateExpression();
expr1.Add( Workbooks.EmployerId = 6 );
Then the second :
PredicateExpression expr2 = new PredicateExpression();
expr2.Add( Workbooks.Inactive = 1 );
expr2.AddWithOr( Workbooks.ExpiryDate < DateTime.Today );
Now, let's combine these two expressions in our filter :
filter.PredicateExpression.Add( expr1 );
filter.PredicateExpression.Add( expr2 );
You're done... You can achieve the same result with fewer lines of code.