Skip to content

Compare QueryExpressions

Daryl LaBar edited this page May 23, 2019 · 3 revisions

For plugins executing against RetrieveMultiple calls in which it should selectively perform logic depending on what is being queried for, it can be difficult to tell if the the QueryExpression being processed is applicable. For example, a ColumnSet may have the same columns, but in a different order. They would generate the same results, and therefor should be considered equal. The following class can be used to simplify comparisons:

if(new ColumnSetComparer().Equals(cs, columnSet)){
   // They match!
}

The calls have been simplified even more so by the IsEqual Extension methods added for ColumnSet, FilterExpression, PagingInfo, and QueryExpression

if(qe1.IsEqual(qe2)){
   // They match!
}

// Or maybe just check ColumnSets
if(qe.ColumnSet.IsEqual(cs){
   // They match!
}
Clone this wiki locally