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>
 ///     Visitor pattern method for LeftOuterJoinOp
 /// </summary>
 /// <param name="op"> The LeftOuterJoinOp being visited </param>
 /// <param name="n"> The Node that references the Op </param>
 public virtual void Visit(LeftOuterJoinOp op, Node n)
 {
     VisitJoinOp(op, n);
 }
예제 #3
0
 // <summary>
 // Copies a LeftOuterJoinOp
 // </summary>
 // <param name="op"> The Op to Copy </param>
 // <param name="n"> The Node that references the Op </param>
 // <returns> A copy of the original Node that references a copy of the original Op </returns>
 public override Node Visit(LeftOuterJoinOp op, Node n)
 {
     return CopyDefault(m_destCmd.CreateLeftOuterJoinOp(), n);
 }