benles wrote:
I'm having trouble understanding how to properly group these expressions:
IPredicateExpression filter = new PredicateExpression();
filter.Add(PredicateFactory.Like(ProjectFieldIndex.Subdomain, ProjectName));
filter.AddWithOr(PredicateFactory.Like(ProjectFieldIndex.Domain, ProjectName));
filter.AddWithAnd(PredicateFactory.CompareValue(ProjectFieldIndex.Archived,
ComparisonOperator.Equal, 0));
p.GetMulti(filter);
I believe this is the relevant example from the manual:
// [C#]
RelationPredicateBucket B = new RelationPredicateBucket();
IPredicateExpression A = new PredicateExpression();
A.Add(PredicateFactory.CompareValue(Table1FieldIndex.Foo, ComparisonOperator.Equal, "One"));
A.AddWithAnd(PredicateFactory.CompareValue(Table1FieldIndex.Bar, ComparisonOperator.Equal, "Two"));
B.PredicateExpression.Add(A);
B.PredicateExpression.AddWithOr(PredicateFactory.CompareValue(Table2FieldIndex.Bar2, ComparisonOperator.Equal, "Three"));
Look at "Generated code - Filtering and sorting, Adapter"