private EntityColumnMap CreateEntityColumnMap( TypeInfo typeInfo, string name, EntityColumnMap superTypeColumnMap, Dictionary <object, TypedColumnMap> discriminatorMap, List <TypedColumnMap> allMaps, bool handleRelProperties) { List <ColumnMap> columnMapList = new List <ColumnMap>(); EntityColumnMap superTypeColumnMap1; if (superTypeColumnMap != null) { foreach (ColumnMap property in superTypeColumnMap.Properties) { columnMapList.Add(property); } foreach (EdmMember structuralMember in TypeHelpers.GetDeclaredStructuralMembers(typeInfo.Type)) { ColumnMap columnMap = this.CreateColumnMap(Helper.GetModelTypeUsage(structuralMember), structuralMember.Name); columnMapList.Add(columnMap); } superTypeColumnMap1 = new EntityColumnMap(typeInfo.Type, name, columnMapList.ToArray(), superTypeColumnMap.EntityIdentity); } else { SimpleColumnMap entitySetIdColumnMap = (SimpleColumnMap)null; if (typeInfo.HasEntitySetIdProperty) { entitySetIdColumnMap = this.CreateEntitySetIdColumnMap(typeInfo.EntitySetIdProperty); } List <SimpleColumnMap> simpleColumnMapList = new List <SimpleColumnMap>(); Dictionary <EdmProperty, ColumnMap> dictionary = new Dictionary <EdmProperty, ColumnMap>(); foreach (EdmMember structuralMember in TypeHelpers.GetDeclaredStructuralMembers(typeInfo.Type)) { ColumnMap columnMap = this.CreateColumnMap(Helper.GetModelTypeUsage(structuralMember), structuralMember.Name); columnMapList.Add(columnMap); if (TypeSemantics.IsPartOfKey(structuralMember)) { EdmProperty index = structuralMember as EdmProperty; System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert(index != null, "EntityType key member is not property?"); dictionary[index] = columnMap; } } foreach (EdmMember keyMember in TypeHelpers.GetEdmType <EntityType>(typeInfo.Type).KeyMembers) { EdmProperty index = keyMember as EdmProperty; System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert(index != null, "EntityType key member is not property?"); SimpleColumnMap simpleColumnMap = dictionary[index] as SimpleColumnMap; System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert(simpleColumnMap != null, "keyColumnMap is null"); simpleColumnMapList.Add(simpleColumnMap); } EntityIdentity entityIdentity = this.CreateEntityIdentity((EntityType)typeInfo.Type.EdmType, entitySetIdColumnMap, simpleColumnMapList.ToArray()); superTypeColumnMap1 = new EntityColumnMap(typeInfo.Type, name, columnMapList.ToArray(), entityIdentity); } if (discriminatorMap != null && typeInfo.TypeId != null) { discriminatorMap[typeInfo.TypeId] = (TypedColumnMap)superTypeColumnMap1; } allMaps?.Add((TypedColumnMap)superTypeColumnMap1); foreach (TypeInfo immediateSubType in typeInfo.ImmediateSubTypes) { this.CreateEntityColumnMap(immediateSubType, name, superTypeColumnMap1, discriminatorMap, allMaps, false); } if (handleRelProperties) { this.BuildRelPropertyColumnMaps(typeInfo, true); } return(superTypeColumnMap1); }