The query behavior that occurs as a result of executing an expression tree that represents calling ThenBy<TSource, TKey>(IOrderedQueryable<TSource>, Expression<Func<TSource, TKey>>, IComparer<TKey>) depends on the implementation of the type of the source parameter. The expected behavior is that it performs a secondary sort of the elements of source based on the key obtained by invoking keySelector on each element of source. All previously established sort orders are preserved. The comparer parameter is used to compare key values.