private bool CompareAggregate(AggregateExpression expression1, AggregateExpression expression2)
 {
     return(expression1.Alias == expression2.Alias &&
            expression1.Method == expression2.Method &&
            expression1.TypeReference.IsEqual(expression2.TypeReference) &&
            _queryNodeComparer.Compare(expression1.Expression, expression2.Expression));
 }
        private bool CompareOrderBy(OrderByClause clause1, OrderByClause clause2, bool navigationNextLink)
        {
            if (clause1 == clause2)
            {
                return(true);
            }
            if (clause1 == null || clause2 == null)
            {
                return(false);
            }

            OeQueryNodeComparer queryNodeComparer = navigationNextLink ? new OeQueryNodeComparer(default(OeCacheComparerParameterValues)) : _queryNodeComparer;

            return(clause1.Direction == clause2.Direction &&
                   clause1.ItemType.IsEqual(clause2.ItemType) &&
                   queryNodeComparer.Compare(clause1.RangeVariable, clause2.RangeVariable) &&
                   queryNodeComparer.Compare(clause1.Expression, clause2.Expression) &&
                   CompareOrderBy(clause1.ThenBy, clause2.ThenBy, navigationNextLink));
        }
        private bool CompareFilter(FilterClause clause1, FilterClause clause2, bool navigationNextLink)
        {
            if (clause1 == clause2)
            {
                return(true);
            }
            if (clause1 == null || clause2 == null)
            {
                return(false);
            }

            if (!clause1.ItemType.IsEqual(clause1.ItemType))
            {
                return(false);
            }

            OeQueryNodeComparer queryNodeComparer = navigationNextLink ? new OeQueryNodeComparer(default(OeCacheComparerParameterValues)) : _queryNodeComparer;

            if (!queryNodeComparer.Compare(clause1.RangeVariable, clause2.RangeVariable))
            {
                return(false);
            }
            return(queryNodeComparer.Compare(clause1.Expression, clause2.Expression));
        }