A predicate expression consists of PredicateExpressionElement objects. Say I:
- Add FieldCompareValuePredicate
- AddWithAnd FieldLikePredicate
This will lead to 3 PredicateExpressionElement objects in the expression, the first for the comparevalue predicate, the second for the and operator and the third for the like predicate.
Now, if you want to change the comparevalue predicate into a fieldcomparesetpredicate, you simply first grab the PredicateExpressionElement object. It has two properties: Type and Contents. Type is a simple flag which tells the predicatexpression evaluator what kind of element it is: an operator or a predicate. In this case, it's a predicate.
You then grab the Contents, and convert it into a FieldCompareSetPredicate, you then simply set the Contents property of the PredicateExpressionElement object to that FieldCompareSetPredicate and you're done.
It is key to do this before the persistence info is added to the predicate expression, which is done at a late point in time so it's likely you are manipulating it before the persistence info is added to the predicateexpression.