src/Shared/EntityFramework/Core/Query/PlanCompiler/ProviderCommandInfoUtils.cs
// <summary>
// Build up a mapping from Vars to the corresponding property of the output row type
// </summary>
// <param name="projectOp"> the physical projectOp </param>
// <param name="outputType"> output type </param>
// <returns> a map from Vars to the output type member </returns>
Build up a mapping from Vars to the corresponding property of the output row type
Build up a mapping from Vars to the corresponding property of the output row type
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "RowType")]
        [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "PhysicalProjectOp")]
        [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters",
            MessageId = "System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert(System.Boolean,System.String)")]
        private static Dictionary<Var, md.EdmProperty> BuildOutputVarMap(PhysicalProjectOp projectOp, md.TypeUsage outputType)
        {
            var outputVarMap = new Dictionary<Var, md.EdmProperty>();
            PlanCompiler.Assert(md.TypeSemantics.IsRowType(outputType), "PhysicalProjectOp result type is not a RowType?");
            IEnumerator<md.EdmProperty> propertyEnumerator = TypeHelpers.GetEdmType<md.RowType>(outputType).Properties.GetEnumerator();
            IEnumerator<Var> varEnumerator = projectOp.Outputs.GetEnumerator();
            while (true)
            {
                var foundProp = propertyEnumerator.MoveNext();
                var foundVar = varEnumerator.MoveNext();
                if (foundProp != foundVar)
                {
                    throw EntityUtil.InternalError(EntityUtil.InternalErrorCode.ColumnCountMismatch, 1, null);
                }
                if (!foundProp)
                {
                    break;
                }
                outputVarMap[varEnumerator.Current] = propertyEnumerator.Current;
            }
            return outputVarMap;
        }
[ SuppressMessage ( " " , " " , MessageId = " " ) ] [ SuppressMessage ( " " , " " , MessageId = " " ) ] [ SuppressMessage ( " " , " " , MessageId = " " ) ] private static Dictionary < Var , md . EdmProperty > BuildOutputVarMap ( PhysicalProjectOp projectOp , md . TypeUsage outputType ) { var outputVarMap = new Dictionary < Var , md . EdmProperty > ( ) ; PlanCompiler . Assert ( md . TypeSemantics . IsRowType ( outputType ) , " " ) ; IEnumerator < md . EdmProperty > propertyEnumerator = TypeHelpers . GetEdmType < md . RowType > ( outputType ) . Properties . GetEnumerator ( ) ; IEnumerator < Var > varEnumerator = projectOp . Outputs . GetEnumerator ( ) ; while ( true ) { var foundProp = propertyEnumerator . MoveNext ( ) ; var foundVar = varEnumerator . MoveNext ( ) ; if ( foundProp != foundVar ) { throw EntityUtil . InternalError ( EntityUtil . InternalErrorCode . ColumnCountMismatch , 1 , null ) ; } if ( ! foundProp ) { break ; } outputVarMap [ varEnumerator . Current ] = propertyEnumerator . Current ; } return outputVarMap ; }
Build up a mapping from Vars to the corresponding property of the output row type
Build up a mapping from Vars to the corresponding property of the output row type
a map from Vars to the output type member
a map from Vars to the output type member
projectOp
PhysicalProjectOp
the physical projectOp
the physical projectOp
outputType
md.TypeUsage
None