Example #1
0
        // <summary>
        // Apply the rules that belong to the specified group to the given query tree.
        // </summary>
        internal static bool Process(PlanCompiler compilerState, TransformationRulesGroup rulesGroup)
        {
            ReadOnlyCollection <ReadOnlyCollection <Rule> > rulesTable = null;

            switch (rulesGroup)
            {
            case TransformationRulesGroup.All:
                rulesTable = AllRulesTable;
                break;

            case TransformationRulesGroup.PostJoinElimination:
                rulesTable = PostJoinEliminationRulesTable;
                break;

            case TransformationRulesGroup.Project:
                rulesTable = ProjectRulesTable;
                break;

            case TransformationRulesGroup.NullSemantics:
                rulesTable = NullSemanticsRulesTable;
                break;
            }

            // If any rule has been applied after which reapplying nullability rules may be useful,
            // reapply nullability rules.
            bool projectionPrunningRequired;

            if (Process(compilerState, rulesTable, out projectionPrunningRequired))
            {
                bool projectionPrunningRequired2;
                Process(compilerState, NullabilityRulesTable, out projectionPrunningRequired2);
                projectionPrunningRequired = projectionPrunningRequired || projectionPrunningRequired2;
            }
            return(projectionPrunningRequired);
        }
 // <summary>
 // Helper method for applying transformation rules
 // </summary>
 private bool ApplyTransformations(ref string dumpString, TransformationRulesGroup rulesGroup)
 {
     if (MayApplyTransformationRules)
     {
         dumpString = SwitchToPhase(PlanCompilerPhase.Transformations);
         return(TransformationRules.Process(this, rulesGroup));
     }
     return(false);
 }
Example #3
0
 /// <summary>
 ///     Helper method for applying transformation rules
 /// </summary>
 /// <param name="dumpString"> </param>
 /// <param name="rulesGroup"> </param>
 /// <returns> </returns>
 private bool ApplyTransformations(ref string dumpString, TransformationRulesGroup rulesGroup)
 {
     if (MayApplyTransformationRules)
     {
         dumpString = SwitchToPhase(PlanCompilerPhase.Transformations);
         return TransformationRules.Process(this, rulesGroup);
     }
     return false;
 }
        // <summary>
        // Apply the rules that belong to the specified group to the given query tree.
        // </summary>
        internal static bool Process(PlanCompiler compilerState, TransformationRulesGroup rulesGroup)
        {
            ReadOnlyCollection<ReadOnlyCollection<Rule>> rulesTable = null;
            switch (rulesGroup)
            {
                case TransformationRulesGroup.All:
                    rulesTable = AllRulesTable;
                    break;
                case TransformationRulesGroup.PostJoinElimination:
                    rulesTable = PostJoinEliminationRulesTable;
                    break;
                case TransformationRulesGroup.Project:
                    rulesTable = ProjectRulesTable;
                    break;
                case TransformationRulesGroup.NullSemantics:
                    rulesTable = NullSemanticsRulesTable;
                    break;
            }

            // If any rule has been applied after which reapplying nullability rules may be useful,
            // reapply nullability rules.
            bool projectionPrunningRequired;
            if (Process(compilerState, rulesTable, out projectionPrunningRequired))
            {
                bool projectionPrunningRequired2;
                Process(compilerState, NullabilityRulesTable, out projectionPrunningRequired2);
                projectionPrunningRequired = projectionPrunningRequired || projectionPrunningRequired2;
            }
            return projectionPrunningRequired;
        }
Example #5
0
        internal static bool Process(System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler compilerState, TransformationRulesGroup rulesGroup)
        {
            ReadOnlyCollection <ReadOnlyCollection <System.Data.Entity.Core.Query.InternalTrees.Rule> > rulesTable = (ReadOnlyCollection <ReadOnlyCollection <System.Data.Entity.Core.Query.InternalTrees.Rule> >)null;

            switch (rulesGroup)
            {
            case TransformationRulesGroup.All:
                rulesTable = TransformationRules.AllRulesTable;
                break;

            case TransformationRulesGroup.Project:
                rulesTable = TransformationRules.ProjectRulesTable;
                break;

            case TransformationRulesGroup.PostJoinElimination:
                rulesTable = TransformationRules.PostJoinEliminationRulesTable;
                break;

            case TransformationRulesGroup.NullSemantics:
                rulesTable = TransformationRules.NullSemanticsRulesTable;
                break;
            }
            bool projectionPruningRequired1;

            if (TransformationRules.Process(compilerState, rulesTable, out projectionPruningRequired1))
            {
                bool projectionPruningRequired2;
                TransformationRules.Process(compilerState, TransformationRules.NullabilityRulesTable, out projectionPruningRequired2);
                projectionPruningRequired1 = projectionPruningRequired1 || projectionPruningRequired2;
            }
            return(projectionPruningRequired1);
        }