src/Shared/EntityFramework.SqlServer/SqlGen/Sql8ExpressionRewriter.cs
// <summary>
// Helper method for
// <see
//     cref="TransformIntersectOrExcept(DbExpression, DbExpression, DbExpressionKind, System.Collections.Generic.IList{System.Data.Entity.Core.Common.CommandTrees.DbPropertyExpression}, string)" />
// Removes all pairs of property expressions from list1 and list2, for which the property expression in list1
// does not have a 'matching' property expression in list2.
// The lists list1 and list2 are known to not create duplicate, and the purpose of the sortList is just for this method.
// Thus, to optimize the match process, we remove the seen property expressions from the sort list in
// <see cref="HasMatchInList" />
// when iterating both list simultaneously.
// </summary>
Helper method for

Removes all pairs of property expressions from list1 and list2, for which the property expression in list1
does not have a 'matching' property expression in list2.
The lists list1 and list2 are known to not create duplicate, and the purpose of the sortList is just for this method.
Thus, to optimize the match process, we remove the seen property expressions from the sort list in

when iterating both list simultaneously.
Helper method for Removes all pairs of property expressions from list1 and list2 for which the property expression in list1 does not have a ' matching ' property expression in list2 . The lists list1 and list2 are known to not create duplicate and the purpose of the sortList is just for this method . Thus to optimize the match process we remove the seen property expressions from the sort list in when iterating both list simultaneously .
private static bool RemoveNonSortProperties(
            IList<DbPropertyExpression> list1, IList<DbPropertyExpression> list2, IList<DbPropertyExpression> sortList,
            string list1BindingVariableName, string sortExpressionsBindingVariableName)
        {
            var result = false;
            for (var i = list1.Count - 1; i >= 0; i--)
            {
                if (!HasMatchInList(list1[i], sortList, list1BindingVariableName, sortExpressionsBindingVariableName))
                {
                    list1.RemoveAt(i);
                    list2.RemoveAt(i);
                    result = true;
                }
            }
            return result;
        }
private static bool RemoveNonSortProperties ( IList < DbPropertyExpression > list1 , IList < DbPropertyExpression > list2 , IList < DbPropertyExpression > sortList , string list1BindingVariableName , string sortExpressionsBindingVariableName ) { var result = false ; for ( var i = list1 . Count - 1 ; i >= 0 ; i -- ) { if ( ! HasMatchInList ( list1 [ i ] , sortList , list1BindingVariableName , sortExpressionsBindingVariableName ) ) { list1 . RemoveAt ( i ) ; list2 . RemoveAt ( i ) ; result = true ; } } return result ; }
Helper method for
Helper method for
list1
IList<DbPropertyExpression>
list2
IList<DbPropertyExpression>
sortList
IList<DbPropertyExpression>
list1BindingVariableName
string
sortExpressionsBindingVariableName
string