System\Data\Common\CommandTrees\ExpressionBuilder\DbExpressionBuilder.cs (5)
1180public static DbRefExpression CreateRef(this EntitySet entitySet, EntityType entityType, IEnumerable<DbExpression> keyValues)
1198public static DbRefExpression CreateRef(this EntitySet entitySet, EntityType entityType, params DbExpression[] keyValues)
1210private static DbRefExpression CreateRefExpression(EntitySet entitySet, EntityType entityType, IEnumerable<DbExpression> keyValues)
1253public static DbRefExpression RefFromKey(this EntitySet entitySet, DbExpression keyRow, EntityType entityType)
2824internal static DbNewInstanceExpression CreateNewEntityWithRelationshipsExpression(EntityType entityType, IList<DbExpression> attributeValues, IList<DbRelatedEntityRef> relationships)
System\Data\Common\CommandTrees\ExpressionBuilder\Internal\ArgumentValidation.cs (8)
114endType = TypeHelpers.CreateReferenceTypeUsage(TypeHelpers.GetEdmType<EntityType>(endType));
1096EntityType entityType;
1112EntityType entityType = null;
1113if (!TypeHelpers.TryGetEdmType<EntityType>(argument.ResultType, out entityType) || null == entityType)
1127internal static TypeUsage ValidateCreateRef(EntitySet entitySet, EntityType entityType, IEnumerable<DbExpression> keyValues, out DbExpression keyConstructor)
1166internal static TypeUsage ValidateRefFromKey(EntitySet entitySet, DbExpression keyValues, EntityType entityType)
1643internal static TypeUsage ValidateNewEntityWithRelationships(EntityType entityType, IEnumerable<DbExpression> attributeValues, IList<DbRelatedEntityRef> relationships, out DbExpressionList validArguments, out System.Collections.ObjectModel.ReadOnlyCollection<DbRelatedEntityRef> validRelatedRefs)
2030retType = TypeHelpers.CreateReferenceTypeUsage(TypeHelpers.GetEdmType<EntityType>(retType));
System\Data\Common\Internal\Materialization\Translator.cs (7)
1218EntityType cSpaceType = (EntityType)columnMap.Type.EdmType;
1307private Expression Emit_ConstructEntity(EntityType oSpaceType, IEnumerable<MemberBinding> propertyBindings, Expression entityKeyReader, Expression entitySetReader, TranslatorArg arg, EntityProxyTypeInfo proxyTypeInfo)
1503Type typeDelegatePairType = typeof(KeyValuePair<EntityType, Func<Shaper, TElement>>);
1504ConstructorInfo typeDelegatePairConstructor = typeDelegatePairType.GetConstructor(new Type[] { typeof(EntityType), typeof(Func<Shaper, TElement>) });
1598EntityType entityTypeMetadata = null;
1599if (TypeHelpers.TryGetEdmType<EntityType>(columnMap.Type, out entityTypeMetadata))
System\Data\Common\Utils\MetadataHelper.cs (43)
33if (typeof(EntityType).Equals(typeof(T)) && resultType is EntityType
219internal static EntityType GetEntityTypeForEnd(AssociationEndMember end)
228return (EntityType)endType;
273internal static bool IsAssociationValidForEntityType(AssociationSetEnd toEnd, EntityType type)
280EntityType fromType = GetEntityTypeForEnd(fromEnd.CorrespondingAssociationEndMember);
369foreach (EdmType subType in GetTypeAndSubtypesOf<EntityType>(type, itemCollection, includeAbstractTypes))
422specificType = specificType.BaseType as EntityType; //The cast is guaranteed to work. See use of GetItems<T_EdmType> in GetTypesAndSubTypesOf()
433internal static Dictionary<EntityType, Set<EntityType>> BuildUndirectedGraphOfTypes(EdmItemCollection edmItemCollection)
435Dictionary<EntityType, Set<EntityType>> graph = new Dictionary<EntityType, Set<EntityType>>();
437IEnumerable<EntityType> typesInWorkSpace = edmItemCollection.GetItems<EntityType>();
438foreach (EntityType childType in typesInWorkSpace)
445EntityType parentType = childType.BaseType as EntityType;
458internal static bool IsParentOf(EntityType a, EntityType b)
460EntityType parent = b.BaseType as EntityType;
470parent = parent.BaseType as EntityType;
481private static void AddDirectedEdgeBetweenEntityTypes(Dictionary<EntityType, Set<EntityType>> graph, EntityType a, EntityType b)
483Set<EntityType> references;
490references = new Set<EntityType>();
506internal static bool DoesEndKeySubsumeAssociationSetKey(AssociationSet assocSet, AssociationEndMember thisEnd, HashSet<Pair<EdmMember, EntityType>> associationkeys)
509EntityType thisEndsEntityType = (EntityType)((RefType)thisEnd.TypeUsage.EdmType).ElementType;
511HashSet<Pair<EdmMember, EntityType>> thisEndKeys = new HashSet<Pair<EdmMember, EntityType>>(
512thisEndsEntityType.KeyMembers.Select(edmMember => new Pair<EdmMember, EntityType>(edmMember, thisEndsEntityType)));
517EntityType otherEndType;
522otherEndType = (EntityType)((RefType)((AssociationEndMember)constraint.FromRole).TypeUsage.EdmType).ElementType;
527otherEndType = (EntityType)((RefType)((AssociationEndMember)constraint.ToRole).TypeUsage.EdmType).ElementType;
538associationkeys.Remove(new Pair<EdmMember, EntityType>(member, otherEndType));
701return ((EntityType)member.DeclaringType).KeyMembers.Contains(member);
905internal static NavigationPropertyAccessor GetNavigationPropertyAccessor(EntityType sourceEntityType, AssociationEndMember sourceMember, AssociationEndMember targetMember)
911internal static NavigationPropertyAccessor GetNavigationPropertyAccessor(EntityType entityType, string relationshipType, string fromName, string toName)
System\Data\Mapping\FunctionImportMapping.cs (37)
63this.MappedEntityTypes = new OM.ReadOnlyCollection<EntityType>(new List<EntityType>());
72var isOfTypeEntityTypeColumnsRenameMapping = new Dictionary<EntityType, OM.Collection<FunctionImportReturnTypePropertyMapping>>();
73var entityTypeColumnsRenameMapping = new Dictionary<EntityType, OM.Collection<FunctionImportReturnTypePropertyMapping>>();
90m_entityTypeLineInfos = new KeyToListMap<EntityType, LineInfo>(EqualityComparer<EntityType>.Default);
91m_isTypeOfLineInfos = new KeyToListMap<EntityType, LineInfo>(EqualityComparer<EntityType>.Default);
96foreach (var entityType in entityTypeMapping.EntityTypes)
100foreach (var isTypeOf in entityTypeMapping.IsOfTypeEntityTypes)
129var impliedEntityTypesSet = new Set<EntityType>(entityTypeMapping.GetMappedEntityTypes(m_itemCollection));
139foreach (var isOfType in entityTypeMapping.IsOfTypeEntityTypes)
150foreach (var entityType in entityTypeMapping.EntityTypes)
193this.MappedEntityTypes = new OM.ReadOnlyCollection<EntityType>(new List<EntityType>() { });
198private readonly KeyToListMap<EntityType, LineInfo> m_entityTypeLineInfos;
199private readonly KeyToListMap<EntityType, LineInfo> m_isTypeOfLineInfos;
204internal readonly OM.ReadOnlyCollection<EntityType> MappedEntityTypes;
226KeyToListMap<EntityType, LineInfo> unreachableEntityTypes;
227KeyToListMap<EntityType, LineInfo> unreachableIsTypeOfs;
275out KeyToListMap<EntityType, LineInfo> unreachableEntityTypes,
276out KeyToListMap<EntityType, LineInfo> unreachableIsTypeOfs)
287Set<EntityType> reachableTypes = validateAmbiguity ?
372private Set<EntityType> FindReachableTypes(DomainConstraintConversionContext<string, ValueCondition> converter, Vertex[] mappingConditions)
400var reachableTypes = new Set<EntityType>();
423private Set<EntityType> FindUnambiguouslyReachableTypes(DomainConstraintConversionContext<string, ValueCondition> converter, Vertex[] mappingConditions)
467var reachableTypes = new Set<EntityType>();
479private void CollectUnreachableTypes(Set<EntityType> reachableTypes, out KeyToListMap<EntityType, LineInfo> entityTypes, out KeyToListMap<EntityType, LineInfo> isTypeOfEntityTypes)
482entityTypes = new KeyToListMap<EntityType, LineInfo>(EqualityComparer<EntityType>.Default);
483isTypeOfEntityTypes = new KeyToListMap<EntityType, LineInfo>(EqualityComparer<EntityType>.Default);
492foreach (var isTypeOf in m_isTypeOfLineInfos.Keys)
495.Cast<EntityType>()
505foreach (var entityType in m_entityTypeLineInfos.Keys)
System\Data\Mapping\StorageMappingItemLoader.cs (44)
905foreach (EntityType unmappedType in unmappedTypes)
927EntityType rootEntityType,
928Func<EntityType, string> typeNotAssignableMessage,
929out Set<EntityType> isOfTypeEntityTypes,
930out Set<EntityType> entityTypes)
935isOfTypeEntityTypes = new Set<EntityType>();
936entityTypes = new Set<EntityType>();
967EntityType entityType;
968if (!this.EdmItemCollection.TryGetItem<EntityType>(entityTypeName, out entityType))
1038Set<EntityType> entityTypes;
1039Set<EntityType> isOfTypeEntityTypes;
1040EntityType rootEntityType = (EntityType)entitySetMapping.Set.ElementType;
1051foreach (EntityType entityType in entityTypes)
1055foreach (EntityType isOfTypeEntityType in isOfTypeEntityTypes)
1150EntityType entityType = (EntityType)entityTypeMapping.Types[0];
1298Set<EntityType> entityTypes;
1299Set<EntityType> isOfTypeEntityTypes;
1300EntityType rootEntityType = (EntityType)setMapping.Set.ElementType;
1312EntityType entityType;
1667EntityType returnEntityType;
1668if (MetadataHelper.TryGetFunctionImportReturnType<EntityType>(functionImport, i, out returnEntityType) &&
1851EntityType resultEntityType;
1852if (MetadataHelper.TryGetFunctionImportReturnType<EntityType>(functionImport, resultSetIndex, out resultEntityType))
1867(EntityType e) => Strings.Mapping_FunctionImport_InvalidContentEntityTypeForEntitySet(e.FullName,
1963EntityType resultEntityType,
1964Func<EntityType, string> registerEntityTypeMismatchError,
1972Set<EntityType> isOfTypeEntityTypes;
1973Set<EntityType> entityTypes;
2106Enumerable.Empty<EntityType>(),
2107new EntityType[] { (EntityType)resultType },
2206if (!TryInferTVFKeysForEntityType((EntityType)typeMapping.Item1, typeMapping.Item3, out currentKeys))
2241private static bool TryInferTVFKeysForEntityType(EntityType entityType, List<StoragePropertyMapping> propertyMappings, out EdmProperty[] keys)
2361var entityType = functionImportKB.MappedEntityTypes[typeID];
2659EntityType tableType = tableMember.ElementType;
2739EntityType tableType = null;
2851((EntityType)refType.ElementType).Properties.TryGetValue(propertyName, false /*ignoreCase*/, out member);
3129private StorageEndPropertyMapping LoadEndPropertyMapping(XPathNavigator nav, AssociationEndMember end, EntityType tableType)
3765internal StorageModificationFunctionMapping LoadEntityTypeModificationFunctionMapping(XPathNavigator nav, EntitySetBase entitySet, bool allowCurrentVersion, bool allowOriginalVersion, EntityType entityType)
3814private IEnumerable<StorageModificationFunctionResultBinding> LoadResultBindings(XPathNavigator nav, EntityType entityType)
4238!((EntityType)type).KeyMembers.TryGetValue(propertyName, false, out property))
System\Data\Mapping\ViewGeneration\DiscriminatorMap.cs (13)
42internal readonly System.Collections.ObjectModel.ReadOnlyCollection<KeyValuePair<object, EntityType>> TypeMap;
60List<KeyValuePair<object, EntityType>> typeMap,
96var typeMap = new List<KeyValuePair<object, EntityType>>();
99var typeToRelPropertyMap = new Dictionary<EntityType, List<Query.InternalTrees.RelProperty>>();
120EntityType currentType;
124typeMap.Add(new KeyValuePair<object, EntityType>(discriminatorValue, currentType));
134EntityType elseType;
137typeMap.Add(new KeyValuePair<object, EntityType>(discriminatorDomain.Single(), elseType));
159Dictionary<EntityType, List<Query.InternalTrees.RelProperty>> typeToRelPropertyMap)
169foreach (KeyValuePair<EntityType, List<Query.InternalTrees.RelProperty>> kv in typeToRelPropertyMap)
186Dictionary<EntityType, List<Query.InternalTrees.RelProperty>> typeToRelPropertyMap,
187out EntityType entityType)
195entityType = (EntityType)constructor.ResultType.EdmType;