Example #1
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);
        }
 // <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);
 }