src/Shared/EntityFramework/Core/Query/PlanCompiler/ColumnMapProcessor.cs
// <summary>
// Create a column map for a ref type
// </summary>
// <param name="typeInfo"> Type information for the ref type </param>
// <param name="name"> Name of the column </param>
// <returns> Column map for the ref type </returns>
Create a column map for a ref type
Create a column map for a ref type
private RefColumnMap CreateRefColumnMap(TypeInfo typeInfo, string name)
        {
            SimpleColumnMap entitySetIdColumnMap = null;
            if (typeInfo.HasEntitySetIdProperty)
            {
                entitySetIdColumnMap = CreateSimpleColumnMap(
                    md.Helper.GetModelTypeUsage(typeInfo.EntitySetIdProperty), c_EntitySetIdColumnName);
            }
            var entityType = (md.EntityType)(TypeHelpers.GetEdmType<md.RefType>(typeInfo.Type).ElementType);
            var keyColList = new SimpleColumnMap[entityType.KeyMembers.Count];
            for (var i = 0; i < keyColList.Length; ++i)
            {
                var property = entityType.KeyMembers[i];
                keyColList[i] = CreateSimpleColumnMap(md.Helper.GetModelTypeUsage(property), property.Name);
            }
            var identity = CreateEntityIdentity(entityType, entitySetIdColumnMap, keyColList);
            var result = new RefColumnMap(typeInfo.Type, name, identity);
            return result;
        }
private RefColumnMap CreateRefColumnMap ( TypeInfo typeInfo , string name ) { SimpleColumnMap entitySetIdColumnMap = null ; if ( typeInfo . HasEntitySetIdProperty ) { entitySetIdColumnMap = CreateSimpleColumnMap ( md . Helper . GetModelTypeUsage ( typeInfo . EntitySetIdProperty ) , c_EntitySetIdColumnName ) ; } var entityType = ( md . EntityType ) ( TypeHelpers . GetEdmType < md . RefType > ( typeInfo . Type ) . ElementType ) ; var keyColList = new SimpleColumnMap [ entityType . KeyMembers . Count ] ; for ( var i = 0 ; i < keyColList . Length ; ++ i ) { var property = entityType . KeyMembers [ i ] ; keyColList [ i ] = CreateSimpleColumnMap ( md . Helper . GetModelTypeUsage ( property ) , property . Name ) ; } var identity = CreateEntityIdentity ( entityType , entitySetIdColumnMap , keyColList ) ; var result = new RefColumnMap ( typeInfo . Type , name , identity ) ; return result ; }
Create a column map for a ref type
Create a column map for a ref type
// get the target entity type,  // Iterate through the list of "key" properties // Create the entity identity
Column map for the ref type
Column map for the ref type
typeInfo
TypeInfo
Type information for the ref type
Type information for the ref type
name
string
Name of the column
Name of the column