src/Shared/EntityFramework.SqlServerCompact/CommandTreeUtils.cs
// <summary>
// Helper method for FlattenAssociativeExpression.
// Creates a flat list of the associative arguments and appends to the given argument list.
// For example, for ((A1 + (A2 - A3)) + A4) it will add A1, (A2 - A3), A4 to the list.
// Only 'unfolds' the given expression if it is of the given expression kind.
// </summary>
Helper method for FlattenAssociativeExpression.
Creates a flat list of the associative arguments and appends to the given argument list.
Helper method for FlattenAssociativeExpression . Creates a flat list of the associative arguments and appends to the given argument list .
private static void ExtractAssociativeArguments(
            DbExpressionKind expressionKind, List<DbExpression> argumentList, DbExpression expression)
        {
            if (expression.ExpressionKind != expressionKind)
            {
                argumentList.Add(expression);
                return;
            }
            var binaryExpression = expression as DbBinaryExpression;
            if (binaryExpression != null)
            {
                ExtractAssociativeArguments(expressionKind, argumentList, binaryExpression.Left);
                ExtractAssociativeArguments(expressionKind, argumentList, binaryExpression.Right);
                return;
            }
            var arithExpression = (DbArithmeticExpression)expression;
            ExtractAssociativeArguments(expressionKind, argumentList, arithExpression.Arguments[0]);
            ExtractAssociativeArguments(expressionKind, argumentList, arithExpression.Arguments[1]);
        }
private static void ExtractAssociativeArguments ( DbExpressionKind expressionKind , List < DbExpression > argumentList , DbExpression expression ) { if ( expression . ExpressionKind != expressionKind ) { argumentList . Add ( expression ) ; return ; } var binaryExpression = expression as DbBinaryExpression ; if ( binaryExpression != null ) { ExtractAssociativeArguments ( expressionKind , argumentList , binaryExpression . Left ) ; ExtractAssociativeArguments ( expressionKind , argumentList , binaryExpression . Right ) ; return ; } var arithExpression = ( DbArithmeticExpression ) expression ; ExtractAssociativeArguments ( expressionKind , argumentList , arithExpression . Arguments [ 0 ] ) ; ExtractAssociativeArguments ( expressionKind , argumentList , arithExpression . Arguments [ 1 ] ) ; }
Helper method for FlattenAssociativeExpression.
Helper method for FlattenAssociativeExpression .
//All associative expressions are binary, thus we must be dealing with a DbBinaryExpresson or  // a DbArithmeticExpression with 2 arguments.
expressionKind
DbExpressionKind
argumentList
List<DbExpression>
expression
DbExpression