コード例 #1
0
ファイル: Funcletizer.cs プロジェクト: zyj0021/ALinq
 private bool IsIndependent(Expression expression)
 {
     if (isUpdateInsertMethod && expression.NodeType == ExpressionType.MemberInit)
     {
         return(false);
     }
     return(DependenceChecker.IsIndependent(expression));
 }
コード例 #2
0
ファイル: Funcletizer.cs プロジェクト: hugufc/data-linq
            internal override Expression Visit(Expression expression)
            {
                if (expression == null)
                {
                    return(null);
                }
                bool saveIsRemote = this.isRemote;

                switch (expression.NodeType)
                {
                case (ExpressionType)InternalExpressionType.Known:
                    return(expression);

                case (ExpressionType)ExpressionType.Constant:
                    break;

                default:
                    this.isRemote = false;
                    base.Visit(expression);
                    if (!this.isRemote &&
                        expression.NodeType != ExpressionType.Lambda &&
                        expression.NodeType != ExpressionType.Quote &&
                        DependenceChecker.IsIndependent(expression))
                    {
                        this.locals[expression] = true;     // Not 'Add' because the same expression may exist in the tree twice.
                    }
                    break;
                }
                if (typeof(ITable).IsAssignableFrom(expression.Type) ||
                    typeof(DataContext).IsAssignableFrom(expression.Type))
                {
                    this.isRemote = true;
                }
                this.isRemote |= saveIsRemote;
                return(expression);
            }