Exemple #1
0
 protected override System.Data.Entity.Core.Query.InternalTrees.Node VisitApplyOp(
     ApplyBaseOp op,
     System.Data.Entity.Core.Query.InternalTrees.Node n)
 {
     this.VisitChildrenReverse(n);
     return(n);
 }
        private static bool ProcessApplyOverAnything(
            RuleProcessingContext context,
            System.Data.Entity.Core.Query.InternalTrees.Node applyNode,
            out System.Data.Entity.Core.Query.InternalTrees.Node newNode)
        {
            newNode = applyNode;
            System.Data.Entity.Core.Query.InternalTrees.Node child0 = applyNode.Child0;
            System.Data.Entity.Core.Query.InternalTrees.Node child1 = applyNode.Child1;
            ApplyBaseOp      applyBaseOp       = (ApplyBaseOp)applyNode.Op;
            Command          command           = context.Command;
            ExtendedNodeInfo extendedNodeInfo1 = command.GetExtendedNodeInfo(child1);
            ExtendedNodeInfo extendedNodeInfo2 = command.GetExtendedNodeInfo(child0);
            bool             flag = false;

            if (applyBaseOp.OpType == OpType.OuterApply && extendedNodeInfo1.MinRows >= RowCount.One)
            {
                applyBaseOp = (ApplyBaseOp)command.CreateCrossApplyOp();
                flag        = true;
            }
            if (extendedNodeInfo1.ExternalReferences.Overlaps(extendedNodeInfo2.Definitions))
            {
                if (!flag)
                {
                    return(false);
                }
                newNode = command.CreateNode((Op)applyBaseOp, child0, child1);
                return(true);
            }
            if (applyBaseOp.OpType == OpType.CrossApply)
            {
                newNode = command.CreateNode((Op)command.CreateCrossJoinOp(), child0, child1);
            }
            else
            {
                LeftOuterJoinOp     leftOuterJoinOp = command.CreateLeftOuterJoinOp();
                ConstantPredicateOp trueOp          = command.CreateTrueOp();
                System.Data.Entity.Core.Query.InternalTrees.Node node = command.CreateNode((Op)trueOp);
                newNode = command.CreateNode((Op)leftOuterJoinOp, child0, child1, node);
            }
            return(true);
        }
 /// <summary>
 /// ApplyOp handling
 /// CrossApplyOp handling
 /// OuterApplyOp handling
 ///
 /// Handling for all ApplyOps: Process the right child, and then
 /// the left child - since the right child may have references to the
 /// left
 /// </summary>
 /// <param name="op">apply op</param>
 /// <param name="n"></param>
 protected override void VisitApplyOp(ApplyBaseOp op, Node n)
 {
     VisitNode(n.Child1); // the right input
     VisitNode(n.Child0); // the left input
 }
 /// <summary>
 ///     ApplyOps
 ///     Common handling for all ApplyOps. Visit the right child first to capture
 ///     any references to the left, and then visit the left child.
 /// </summary>
 /// <param name="op"> </param>
 /// <param name="n"> the apply op </param>
 /// <returns> modified subtree </returns>
 protected override Node VisitApplyOp(ApplyBaseOp op, Node n)
 {
     // visit the right child first, then the left
     VisitChildrenReverse(n);
     return(n);
 }
Exemple #5
0
 protected override void VisitApplyOp(ApplyBaseOp op, System.Data.Entity.Core.Query.InternalTrees.Node n)
 {
     this.VisitNode(n.Child1);
     this.VisitNode(n.Child0);
 }