GroupByExpressionRewriter.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Objects / ELinq / GroupByExpressionRewriter.cs / 2 / GroupByExpressionRewriter.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner  [....], [....]
//--------------------------------------------------------------------- 
 
using System.Data.Common.CommandTrees;
using System.Collections.Generic; 
using CqtExpression = System.Data.Common.CommandTrees.DbExpression;
using LinqExpression = System.Linq.Expressions.Expression;
using System.Diagnostics;
using System.Data.Metadata.Edm; 
namespace System.Data.Objects.ELinq
{ 
    internal sealed partial class ExpressionConverter 
    {
        ///  
        /// Expression visitor that tries to rewrite a given inputExpression to be over the
        /// optimized translation of a group by input.
        /// 
        private class GroupByExpressionRewriter : DbExpressionVisitor 
        {
            #region Private State 
            private Dictionary> _aggregateDefaultTranslationToOptimizedTranslationInfoMap; 
            private DbCommandTree _commandTree;
            private string _sourceBindingVariableName; 
            private DbVariableReferenceExpression _optimizedSourceBindingVarRef;
            private DbGroupByTemplate _optimizedGroupByTemplate;
            #endregion
 
            #region Constructor
            private GroupByExpressionRewriter(ExpressionConverter parent, CqtExpression inputExpression, string sourceBindingVariableName, DbVariableReferenceExpression optimizedSourceBindingVarRef, DbGroupByTemplate optimizedGroupByTemplate) 
            { 
                _commandTree = parent._commandTree;
                _aggregateDefaultTranslationToOptimizedTranslationInfoMap = parent._aggregateDefaultTranslationToOptimizedTranslationInfoMap; 
                _sourceBindingVariableName = sourceBindingVariableName;
                _optimizedSourceBindingVarRef = optimizedSourceBindingVarRef;
                _optimizedGroupByTemplate = optimizedGroupByTemplate;
            } 
            #endregion
 
            #region Public Surface 
            internal static bool TryRewrite(ExpressionConverter parent, CqtExpression inputExpression, string sourceBindingVariableName, DbVariableReferenceExpression optimizedSourceBindingVarRef, DbGroupByTemplate optimizedGroupByTemplate, out CqtExpression outputExpression)
            { 
                GroupByExpressionRewriter rewriter = new GroupByExpressionRewriter(parent, inputExpression, sourceBindingVariableName, optimizedSourceBindingVarRef, optimizedGroupByTemplate);
                outputExpression = rewriter.VisitExpr(inputExpression);
                return (outputExpression != null);
            } 
            #endregion
 
            #region Visitor Helper Methods 
            public IList VisitList(IList exprList) where T : DbExpression
            { 
                IList retList = new List();
                bool allEqual = true; // if all arguments come back as equal we simply return the input list

                for (int idx = 0; idx < exprList.Count; idx++) 
                {
                    CqtExpression newListMember = this.VisitExpr(exprList[idx]); 
                    if (newListMember == null) 
                    {
                        return null; 
                    }
                    if (newListMember != exprList[idx])
                    {
                        allEqual = false; 
                    }
                    retList.Add((T)newListMember); 
                } 

                if (allEqual) 
                {
                    retList = exprList;
                }
                return retList; 
            }
 
            public IList VisitExprList(IList exprList) 
            {
                return VisitList(exprList); 
            }

            public DbExpression VisitExpr(DbExpression expr)
            { 
                return expr.Accept(this);
            } 
            #endregion 

            #region DbExpressionVisitor Members 

            public override DbExpression Visit(DbExpression e)
            {
                throw EntityUtil.NotSupported(System.Data.Entity.Strings.Cqt_General_UnsupportedExpression(e.GetType().FullName)); 
            }
 
            public override DbExpression Visit(DbConstantExpression e) 
            {
                return e; 
            }

            public override DbExpression Visit(DbNullExpression e)
            { 
                return e;
            } 
 
            public override DbExpression Visit(DbVariableReferenceExpression e)
            { 
                return null;
            }

            public override DbExpression Visit(DbParameterReferenceExpression e) 
            {
                Debug.Assert(TypeSemantics.IsPrimitiveType(e.ResultType), "Parameters are expected to be of primitive types only"); 
                return e; 
            }
 
            public override DbExpression Visit(DbFunctionExpression e)
            {
                return null;
            } 

            public override DbExpression Visit(DbPropertyExpression e) 
            { 
                if (e.Instance.ExpressionKind == DbExpressionKind.VariableReference)
                { 
                    DbVariableReferenceExpression varRefExpression = (DbVariableReferenceExpression)e.Instance;
                    if (varRefExpression.VariableName == _sourceBindingVariableName)
                    {
                        if (e.Property.Name != KeyColumnName) 
                        {
                            return null; 
                        } 
                        return _commandTree.CreatePropertyExpression(KeyColumnName, _optimizedSourceBindingVarRef);
                    } 
                    //it may be case that can be handled, but not handling for now
                    return null;
                }
 
                CqtExpression propertyInstance = this.VisitExpr(e.Instance);
                if (propertyInstance == null) 
                { 
                    return null;
                } 
                return _commandTree.CreatePropertyExpression(e.Property.Name, propertyInstance);
            }

            public override DbExpression Visit(DbComparisonExpression e) 
            {
                DbExpression left = VisitExpr(e.Left); 
                if (left == null) 
                {
                    return null; 
                }
                DbExpression right = VisitExpr(e.Right);
                if (right == null)
                { 
                    return null;
                } 
 
                if (e.Left == left && e.Right == right)
                { 
                    return e;
                }

                switch (e.ExpressionKind) 
                {
                    case DbExpressionKind.Equals: 
                        return _commandTree.CreateEqualsExpression(left, right); 

                    case DbExpressionKind.NotEquals: 
                        return _commandTree.CreateNotEqualsExpression(left, right);

                    case DbExpressionKind.LessThan:
                        return _commandTree.CreateLessThanExpression(left, right); 

                    case DbExpressionKind.GreaterThan: 
                        return _commandTree.CreateGreaterThanExpression(left, right); 

                    case DbExpressionKind.LessThanOrEquals: 
                        return _commandTree.CreateLessThanOrEqualsExpression(left, right);

                    case DbExpressionKind.GreaterThanOrEquals:
                        return _commandTree.CreateGreaterThanOrEqualsExpression(left, right); 

                    default: 
                        Debug.Fail("Unhandled expression kind?"); 
                        return null;
                } 
            }

            public override DbExpression Visit(DbLikeExpression e)
            { 
                return null;
            } 
 
            public override DbExpression Visit(DbLimitExpression e)
            { 
                return null;
            }

            public override DbExpression Visit(DbIsNullExpression e) 
            {
                DbExpression operand = this.VisitExpr(e.Argument); 
                if (operand == null) 
                {
                    return null; 
                }
                if (operand == e.Argument)
                {
                    return e; 
                }
                return this._commandTree.CreateIsNullExpression(operand); 
            } 

            public override DbExpression Visit(DbArithmeticExpression e) 
            {
                IList args = VisitExprList(e.Arguments);

                if (args == null) 
                {
                    return null; 
                } 

                if (args == e.Arguments) 
                {
                    return e;
                }
 
                switch (e.ExpressionKind)
                { 
                    case DbExpressionKind.Plus: 
                        return _commandTree.CreatePlusExpression(args[0], args[1]);
 
                    case DbExpressionKind.Minus:
                        return _commandTree.CreateMinusExpression(args[0], args[1]);

                    case DbExpressionKind.Multiply: 
                        return _commandTree.CreateMultiplyExpression(args[0], args[1]);
 
                    case DbExpressionKind.Divide: 
                        return _commandTree.CreateDivideExpression(args[0], args[1]);
 
                    case DbExpressionKind.Modulo:
                        return _commandTree.CreateModuloExpression(args[0], args[1]);

                    case DbExpressionKind.UnaryMinus: 
                        return _commandTree.CreateUnaryMinusExpression(args[0]);
 
                    default: 
                        Debug.Fail("Unhandled expression kind?");
                        return null; 
                }
            }

            public override DbExpression Visit(DbAndExpression e) 
            {
                DbExpression left = VisitExpr(e.Left); 
                if (left == null) 
                {
                    return null; 
                }
                DbExpression right = VisitExpr(e.Right);
                if (right == null)
                { 
                    return null;
                } 
                if (e.Left == left && e.Right == right) 
                {
                    return e; 
                }
                return _commandTree.CreateAndExpression(left, right);
            }
 
            public override DbExpression Visit(DbOrExpression e)
            { 
                DbExpression left = VisitExpr(e.Left); 
                if (left == null)
                { 
                    return null;
                }
                DbExpression right = VisitExpr(e.Right);
                if (right == null) 
                {
                    return null; 
                } 
                if (e.Left == left && e.Right == right)
                { 
                    return e;
                }
                return _commandTree.CreateOrExpression(left, right);
            } 

            public override DbExpression Visit(DbNotExpression e) 
            { 
                DbExpression operand = this.VisitExpr(e.Argument);
                if (operand == null) 
                {
                    return null;
                }
                if (operand == e.Argument) 
                {
                    return e; 
                } 
                return this._commandTree.CreateNotExpression(operand);
            } 

            public override DbExpression Visit(DbDistinctExpression e)
            {
                return null; 
            }
 
            public override DbExpression Visit(DbElementExpression e) 
            {
                //Aggregate by default get translated as ElementExpressions 
                KeyValuePair optimizedAggregateInfo;
                if (!_aggregateDefaultTranslationToOptimizedTranslationInfoMap.TryGetValue(e, out optimizedAggregateInfo))
                {
                    return null; 
                }
                //Make sure it was optimized over this group by. 
                if (optimizedAggregateInfo.Key != _optimizedGroupByTemplate) 
                {
                    return null; 
                }
                return _commandTree.CreatePropertyExpression(optimizedAggregateInfo.Value, _optimizedSourceBindingVarRef);
            }
 
            public override DbExpression Visit(DbIsEmptyExpression e)
            { 
                return null; 
            }
 
            public override DbExpression Visit(DbUnionAllExpression e)
            {
                return null;
            } 

            public override DbExpression Visit(DbIntersectExpression e) 
            { 
                return null;
            } 

            public override DbExpression Visit(DbExceptExpression e)
            {
                return null; 
            }
 
            public override DbExpression Visit(DbTreatExpression e) 
            {
                return null; 
            }

            public override DbExpression Visit(DbCastExpression e)
            { 
                CqtExpression arg = this.VisitExpr(e.Argument);
                if (arg == null) 
                { 
                    return null;
                } 
                if (arg == e.Argument)
                {
                    return e;
                } 
                return _commandTree.CreateCastExpression(arg, e.ResultType);
            } 
 
            public override DbExpression Visit(DbIsOfExpression e)
            { 
                return null;
            }

            public override DbExpression Visit(DbOfTypeExpression e) 
            {
                return null; 
            } 

            public override DbExpression Visit(DbCaseExpression e) 
            {
                IList whens = VisitExprList(e.When);
                if (whens == null)
                { 
                    return null;
                } 
 
                IList thens = VisitExprList(e.Then);
                if (thens == null) 
                {
                    return null;
                }
 
                CqtExpression elseClause = VisitExpr(e.Else);
                if (elseClause == null) 
                { 
                    return null;
                } 

                if (whens == e.When && thens == e.Then && elseClause == e.Else)
                {
                    return e; 
                }
 
                return _commandTree.CreateCaseExpression(whens, thens, elseClause); 
            }
 
            public override DbExpression Visit(DbNewInstanceExpression e)
            {
                IList newArguments = VisitExprList(e.Arguments);
                if (newArguments == null) 
                {
                    return null; 
                } 
                if (newArguments == e.Arguments)
                { 
                    return e;
                }
                return _commandTree.CreateNewInstanceExpression(e.ResultType, newArguments);
            } 

            public override DbExpression Visit(DbRefExpression e) 
            { 
                return null;
            } 

            public override DbExpression Visit(DbRelationshipNavigationExpression e)
            {
                return null; 
            }
 
            public override DbExpression Visit(DbDerefExpression e) 
            {
                return null; 
            }

            public override DbExpression Visit(DbRefKeyExpression e)
            { 
                return null;
            } 
 
            public override DbExpression Visit(DbEntityRefExpression e)
            { 
                return null;
            }

            public override DbExpression Visit(DbScanExpression e) 
            {
                return null; 
            } 

            public override DbExpression Visit(DbFilterExpression e) 
            {
                return null;
            }
 
            public override DbExpression Visit(DbProjectExpression e)
            { 
                return null; 
            }
 
            public override DbExpression Visit(DbCrossJoinExpression e)
            {
                return null;
            } 

            public override DbExpression Visit(DbJoinExpression e) 
            { 
                return null;
            } 

            public override DbExpression Visit(DbApplyExpression e)
            {
                return null; 
            }
 
            public override DbExpression Visit(DbGroupByExpression e) 
            {
                return null; 
            }

            public override DbExpression Visit(DbSkipExpression e)
            { 
                return null;
            } 
 
            public override DbExpression Visit(DbSortExpression e)
            { 
                return null;
            }

            public override DbExpression Visit(DbQuantifierExpression e) 
            {
                return null; 
            } 
            #endregion
        } 

    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner  [....], [....]
//--------------------------------------------------------------------- 
 
using System.Data.Common.CommandTrees;
using System.Collections.Generic; 
using CqtExpression = System.Data.Common.CommandTrees.DbExpression;
using LinqExpression = System.Linq.Expressions.Expression;
using System.Diagnostics;
using System.Data.Metadata.Edm; 
namespace System.Data.Objects.ELinq
{ 
    internal sealed partial class ExpressionConverter 
    {
        ///  
        /// Expression visitor that tries to rewrite a given inputExpression to be over the
        /// optimized translation of a group by input.
        /// 
        private class GroupByExpressionRewriter : DbExpressionVisitor 
        {
            #region Private State 
            private Dictionary> _aggregateDefaultTranslationToOptimizedTranslationInfoMap; 
            private DbCommandTree _commandTree;
            private string _sourceBindingVariableName; 
            private DbVariableReferenceExpression _optimizedSourceBindingVarRef;
            private DbGroupByTemplate _optimizedGroupByTemplate;
            #endregion
 
            #region Constructor
            private GroupByExpressionRewriter(ExpressionConverter parent, CqtExpression inputExpression, string sourceBindingVariableName, DbVariableReferenceExpression optimizedSourceBindingVarRef, DbGroupByTemplate optimizedGroupByTemplate) 
            { 
                _commandTree = parent._commandTree;
                _aggregateDefaultTranslationToOptimizedTranslationInfoMap = parent._aggregateDefaultTranslationToOptimizedTranslationInfoMap; 
                _sourceBindingVariableName = sourceBindingVariableName;
                _optimizedSourceBindingVarRef = optimizedSourceBindingVarRef;
                _optimizedGroupByTemplate = optimizedGroupByTemplate;
            } 
            #endregion
 
            #region Public Surface 
            internal static bool TryRewrite(ExpressionConverter parent, CqtExpression inputExpression, string sourceBindingVariableName, DbVariableReferenceExpression optimizedSourceBindingVarRef, DbGroupByTemplate optimizedGroupByTemplate, out CqtExpression outputExpression)
            { 
                GroupByExpressionRewriter rewriter = new GroupByExpressionRewriter(parent, inputExpression, sourceBindingVariableName, optimizedSourceBindingVarRef, optimizedGroupByTemplate);
                outputExpression = rewriter.VisitExpr(inputExpression);
                return (outputExpression != null);
            } 
            #endregion
 
            #region Visitor Helper Methods 
            public IList VisitList(IList exprList) where T : DbExpression
            { 
                IList retList = new List();
                bool allEqual = true; // if all arguments come back as equal we simply return the input list

                for (int idx = 0; idx < exprList.Count; idx++) 
                {
                    CqtExpression newListMember = this.VisitExpr(exprList[idx]); 
                    if (newListMember == null) 
                    {
                        return null; 
                    }
                    if (newListMember != exprList[idx])
                    {
                        allEqual = false; 
                    }
                    retList.Add((T)newListMember); 
                } 

                if (allEqual) 
                {
                    retList = exprList;
                }
                return retList; 
            }
 
            public IList VisitExprList(IList exprList) 
            {
                return VisitList(exprList); 
            }

            public DbExpression VisitExpr(DbExpression expr)
            { 
                return expr.Accept(this);
            } 
            #endregion 

            #region DbExpressionVisitor Members 

            public override DbExpression Visit(DbExpression e)
            {
                throw EntityUtil.NotSupported(System.Data.Entity.Strings.Cqt_General_UnsupportedExpression(e.GetType().FullName)); 
            }
 
            public override DbExpression Visit(DbConstantExpression e) 
            {
                return e; 
            }

            public override DbExpression Visit(DbNullExpression e)
            { 
                return e;
            } 
 
            public override DbExpression Visit(DbVariableReferenceExpression e)
            { 
                return null;
            }

            public override DbExpression Visit(DbParameterReferenceExpression e) 
            {
                Debug.Assert(TypeSemantics.IsPrimitiveType(e.ResultType), "Parameters are expected to be of primitive types only"); 
                return e; 
            }
 
            public override DbExpression Visit(DbFunctionExpression e)
            {
                return null;
            } 

            public override DbExpression Visit(DbPropertyExpression e) 
            { 
                if (e.Instance.ExpressionKind == DbExpressionKind.VariableReference)
                { 
                    DbVariableReferenceExpression varRefExpression = (DbVariableReferenceExpression)e.Instance;
                    if (varRefExpression.VariableName == _sourceBindingVariableName)
                    {
                        if (e.Property.Name != KeyColumnName) 
                        {
                            return null; 
                        } 
                        return _commandTree.CreatePropertyExpression(KeyColumnName, _optimizedSourceBindingVarRef);
                    } 
                    //it may be case that can be handled, but not handling for now
                    return null;
                }
 
                CqtExpression propertyInstance = this.VisitExpr(e.Instance);
                if (propertyInstance == null) 
                { 
                    return null;
                } 
                return _commandTree.CreatePropertyExpression(e.Property.Name, propertyInstance);
            }

            public override DbExpression Visit(DbComparisonExpression e) 
            {
                DbExpression left = VisitExpr(e.Left); 
                if (left == null) 
                {
                    return null; 
                }
                DbExpression right = VisitExpr(e.Right);
                if (right == null)
                { 
                    return null;
                } 
 
                if (e.Left == left && e.Right == right)
                { 
                    return e;
                }

                switch (e.ExpressionKind) 
                {
                    case DbExpressionKind.Equals: 
                        return _commandTree.CreateEqualsExpression(left, right); 

                    case DbExpressionKind.NotEquals: 
                        return _commandTree.CreateNotEqualsExpression(left, right);

                    case DbExpressionKind.LessThan:
                        return _commandTree.CreateLessThanExpression(left, right); 

                    case DbExpressionKind.GreaterThan: 
                        return _commandTree.CreateGreaterThanExpression(left, right); 

                    case DbExpressionKind.LessThanOrEquals: 
                        return _commandTree.CreateLessThanOrEqualsExpression(left, right);

                    case DbExpressionKind.GreaterThanOrEquals:
                        return _commandTree.CreateGreaterThanOrEqualsExpression(left, right); 

                    default: 
                        Debug.Fail("Unhandled expression kind?"); 
                        return null;
                } 
            }

            public override DbExpression Visit(DbLikeExpression e)
            { 
                return null;
            } 
 
            public override DbExpression Visit(DbLimitExpression e)
            { 
                return null;
            }

            public override DbExpression Visit(DbIsNullExpression e) 
            {
                DbExpression operand = this.VisitExpr(e.Argument); 
                if (operand == null) 
                {
                    return null; 
                }
                if (operand == e.Argument)
                {
                    return e; 
                }
                return this._commandTree.CreateIsNullExpression(operand); 
            } 

            public override DbExpression Visit(DbArithmeticExpression e) 
            {
                IList args = VisitExprList(e.Arguments);

                if (args == null) 
                {
                    return null; 
                } 

                if (args == e.Arguments) 
                {
                    return e;
                }
 
                switch (e.ExpressionKind)
                { 
                    case DbExpressionKind.Plus: 
                        return _commandTree.CreatePlusExpression(args[0], args[1]);
 
                    case DbExpressionKind.Minus:
                        return _commandTree.CreateMinusExpression(args[0], args[1]);

                    case DbExpressionKind.Multiply: 
                        return _commandTree.CreateMultiplyExpression(args[0], args[1]);
 
                    case DbExpressionKind.Divide: 
                        return _commandTree.CreateDivideExpression(args[0], args[1]);
 
                    case DbExpressionKind.Modulo:
                        return _commandTree.CreateModuloExpression(args[0], args[1]);

                    case DbExpressionKind.UnaryMinus: 
                        return _commandTree.CreateUnaryMinusExpression(args[0]);
 
                    default: 
                        Debug.Fail("Unhandled expression kind?");
                        return null; 
                }
            }

            public override DbExpression Visit(DbAndExpression e) 
            {
                DbExpression left = VisitExpr(e.Left); 
                if (left == null) 
                {
                    return null; 
                }
                DbExpression right = VisitExpr(e.Right);
                if (right == null)
                { 
                    return null;
                } 
                if (e.Left == left && e.Right == right) 
                {
                    return e; 
                }
                return _commandTree.CreateAndExpression(left, right);
            }
 
            public override DbExpression Visit(DbOrExpression e)
            { 
                DbExpression left = VisitExpr(e.Left); 
                if (left == null)
                { 
                    return null;
                }
                DbExpression right = VisitExpr(e.Right);
                if (right == null) 
                {
                    return null; 
                } 
                if (e.Left == left && e.Right == right)
                { 
                    return e;
                }
                return _commandTree.CreateOrExpression(left, right);
            } 

            public override DbExpression Visit(DbNotExpression e) 
            { 
                DbExpression operand = this.VisitExpr(e.Argument);
                if (operand == null) 
                {
                    return null;
                }
                if (operand == e.Argument) 
                {
                    return e; 
                } 
                return this._commandTree.CreateNotExpression(operand);
            } 

            public override DbExpression Visit(DbDistinctExpression e)
            {
                return null; 
            }
 
            public override DbExpression Visit(DbElementExpression e) 
            {
                //Aggregate by default get translated as ElementExpressions 
                KeyValuePair optimizedAggregateInfo;
                if (!_aggregateDefaultTranslationToOptimizedTranslationInfoMap.TryGetValue(e, out optimizedAggregateInfo))
                {
                    return null; 
                }
                //Make sure it was optimized over this group by. 
                if (optimizedAggregateInfo.Key != _optimizedGroupByTemplate) 
                {
                    return null; 
                }
                return _commandTree.CreatePropertyExpression(optimizedAggregateInfo.Value, _optimizedSourceBindingVarRef);
            }
 
            public override DbExpression Visit(DbIsEmptyExpression e)
            { 
                return null; 
            }
 
            public override DbExpression Visit(DbUnionAllExpression e)
            {
                return null;
            } 

            public override DbExpression Visit(DbIntersectExpression e) 
            { 
                return null;
            } 

            public override DbExpression Visit(DbExceptExpression e)
            {
                return null; 
            }
 
            public override DbExpression Visit(DbTreatExpression e) 
            {
                return null; 
            }

            public override DbExpression Visit(DbCastExpression e)
            { 
                CqtExpression arg = this.VisitExpr(e.Argument);
                if (arg == null) 
                { 
                    return null;
                } 
                if (arg == e.Argument)
                {
                    return e;
                } 
                return _commandTree.CreateCastExpression(arg, e.ResultType);
            } 
 
            public override DbExpression Visit(DbIsOfExpression e)
            { 
                return null;
            }

            public override DbExpression Visit(DbOfTypeExpression e) 
            {
                return null; 
            } 

            public override DbExpression Visit(DbCaseExpression e) 
            {
                IList whens = VisitExprList(e.When);
                if (whens == null)
                { 
                    return null;
                } 
 
                IList thens = VisitExprList(e.Then);
                if (thens == null) 
                {
                    return null;
                }
 
                CqtExpression elseClause = VisitExpr(e.Else);
                if (elseClause == null) 
                { 
                    return null;
                } 

                if (whens == e.When && thens == e.Then && elseClause == e.Else)
                {
                    return e; 
                }
 
                return _commandTree.CreateCaseExpression(whens, thens, elseClause); 
            }
 
            public override DbExpression Visit(DbNewInstanceExpression e)
            {
                IList newArguments = VisitExprList(e.Arguments);
                if (newArguments == null) 
                {
                    return null; 
                } 
                if (newArguments == e.Arguments)
                { 
                    return e;
                }
                return _commandTree.CreateNewInstanceExpression(e.ResultType, newArguments);
            } 

            public override DbExpression Visit(DbRefExpression e) 
            { 
                return null;
            } 

            public override DbExpression Visit(DbRelationshipNavigationExpression e)
            {
                return null; 
            }
 
            public override DbExpression Visit(DbDerefExpression e) 
            {
                return null; 
            }

            public override DbExpression Visit(DbRefKeyExpression e)
            { 
                return null;
            } 
 
            public override DbExpression Visit(DbEntityRefExpression e)
            { 
                return null;
            }

            public override DbExpression Visit(DbScanExpression e) 
            {
                return null; 
            } 

            public override DbExpression Visit(DbFilterExpression e) 
            {
                return null;
            }
 
            public override DbExpression Visit(DbProjectExpression e)
            { 
                return null; 
            }
 
            public override DbExpression Visit(DbCrossJoinExpression e)
            {
                return null;
            } 

            public override DbExpression Visit(DbJoinExpression e) 
            { 
                return null;
            } 

            public override DbExpression Visit(DbApplyExpression e)
            {
                return null; 
            }
 
            public override DbExpression Visit(DbGroupByExpression e) 
            {
                return null; 
            }

            public override DbExpression Visit(DbSkipExpression e)
            { 
                return null;
            } 
 
            public override DbExpression Visit(DbSortExpression e)
            { 
                return null;
            }

            public override DbExpression Visit(DbQuantifierExpression e) 
            {
                return null; 
            } 
            #endregion
        } 

    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK