System\Data\Common\EntitySql\SemanticAnalyzer.cs (104)
322if (Helper.IsCollectionType(resultType.EdmType))
324ValidateQueryResultType(((CollectionType)resultType.EdmType).TypeUsage, errCtx);
326else if (Helper.IsRowType(resultType.EdmType))
328foreach (EdmProperty property in ((RowType)resultType.EdmType).Properties)
333else if (Helper.IsAssociationType(resultType.EdmType))
335throw EntityUtil.EntitySqlError(errCtx, Strings.InvalidQueryResultType(resultType.EdmType.FullName));
976throw EntityUtil.EntitySqlError(methodExpr.ErrCtx, Strings.InvalidCtorUseOnType(metadataType.TypeUsage.EdmType.FullName));
982if (metadataType.TypeUsage.EdmType.Abstract)
984throw EntityUtil.EntitySqlError(methodExpr.ErrCtx, Strings.CannotInstantiateAbstractType(metadataType.TypeUsage.EdmType.FullName));
1007EntityType driverEntityType = metadataType.TypeUsage.EdmType as EntityType;
1340StructuralType stype = (StructuralType)type.EdmType;
1345Debug.Assert(memberModelTypeUsage.EdmType.DataSpace == DataSpace.CSpace, "member space must be CSpace");
1380args[idx].ResultType.EdmType.FullName,
1382memberModelTypeUsage.EdmType.FullName));
1385if (Helper.IsPrimitiveType(memberModelTypeUsage.EdmType) &&
1397args[idx].ResultType.EdmType.FullName,
1399memberModelTypeUsage.EdmType.FullName));
1419EntityType entityType = (EntityType)type.EdmType;
1559var edmType = ConvertTypeName(relshipExpr.TypeName, sr).EdmType;
1574var refType = targetEntityRef.ResultType.EdmType as RefType;
1599if (!TypeSemantics.IsStructurallyEqualOrPromotableTo(refType, toEnd.TypeUsage.EdmType))
1601throw EntityUtil.EntitySqlError(relshipExpr.RefExpr.ErrCtx, Strings.RelatedEndExprTypeMustBePromotoableToToEnd(refType.FullName, toEnd.TypeUsage.EdmType.FullName));
1607.Where (e => TypeSemantics.IsStructurallyEqualOrPromotableTo(refType, e.TypeUsage.EdmType) &&
1634if (!TypeSemantics.IsStructurallyEqualOrPromotableTo(driverEntityType.GetReferenceType(), fromEnd.TypeUsage.EdmType))
1637Strings.SourceTypeMustBePromotoableToFromEndRelationType(driverEntityType.FullName, fromEnd.TypeUsage.EdmType.FullName));
1647.Where(e => TypeSemantics.IsStructurallyEqualOrPromotableTo(driverEntityType.GetReferenceType(), e.TypeUsage.EdmType) &&
1676var edmType = ConvertTypeName(relshipExpr.TypeName, sr).EdmType;
1691var sourceRefType = sourceEntityRef.ResultType.EdmType as RefType;
1694var entityType = sourceEntityRef.ResultType.EdmType as EntityType;
1698sourceRefType = (RefType)sourceEntityRef.ResultType.EdmType;
1734if (!TypeSemantics.IsStructurallyEqualOrPromotableTo(sourceRefType, fromEnd.TypeUsage.EdmType))
1737Strings.SourceTypeMustBePromotoableToFromEndRelationType(sourceRefType.FullName, fromEnd.TypeUsage.EdmType.FullName));
1747.Where (e => TypeSemantics.IsStructurallyEqualOrPromotableTo(sourceRefType, e.TypeUsage.EdmType) &&
1807throw EntityUtil.EntitySqlError(refExpr.ArgExpr.ErrCtx, Strings.RefArgIsNotOfEntityType(converted.ResultType.EdmType.FullName));
1835throw EntityUtil.EntitySqlError(deRefExpr.ArgExpr.ErrCtx, Strings.DeRefArgIsNotOfRefType(converted.ResultType.EdmType.FullName));
1876RowType inputKeyRowType = keyRowExpression.ResultType.EdmType as RowType;
1909targetTypeUsage.EdmType.FullName,
1910targetTypeUsage.EdmType.BuiltInTypeKind.ToString()));
1913if (!TypeSemantics.IsValidPolymorphicCast(entitySet.ElementType, targetTypeUsage.EdmType))
1918targetTypeUsage.EdmType.FullName));
1921converted = DbExpressionBuilder.RefFromKey(entitySet, keyRowExpression, (EntityType)targetTypeUsage.EdmType);
1951throw EntityUtil.EntitySqlError(keyExpr.ArgExpr.ErrCtx, Strings.InvalidKeyArgument(converted.ResultType.EdmType.FullName));
2006operands.Left.ResultType.EdmType.FullName, operands.Right.ResultType.EdmType.FullName));
2041operands.Left.ResultType.EdmType.FullName, operands.Right.ResultType.EdmType.FullName));
2114compArgs.Left.ResultType.EdmType.FullName, compArgs.Right.ResultType.EdmType.FullName));
2141compArgs.Left.ResultType.EdmType.FullName, compArgs.Right.ResultType.EdmType.FullName));
2210TypeHelpers.GetElementTypeUsage(leftExpr.ResultType).EdmType.FullName));
2222TypeHelpers.GetElementTypeUsage(rightExpr.ResultType).EdmType.FullName));
2227if (Helper.IsAssociationType(leftElemType.EdmType))
2229throw EntityUtil.EntitySqlError(astBuiltInExpr.Arg1.ErrCtx, Strings.InvalidAssociationTypeForUnion(leftElemType.EdmType.FullName));
2232if (Helper.IsAssociationType(rightElemType.EdmType))
2234throw EntityUtil.EntitySqlError(astBuiltInExpr.Arg2.ErrCtx, Strings.InvalidAssociationTypeForUnion(rightElemType.EdmType.FullName));
2301throw EntityUtil.EntitySqlError(astBuiltInExpr.ErrCtx, Strings.InvalidInExprArgs(leftExpr.ResultType.EdmType.FullName, rightExpr.ResultType.EdmType.FullName));
2410PrimitiveType primitiveType = parameterizedType.EdmType as PrimitiveType;
2503targetTypeUsage.EdmType.FullName,
2504targetTypeUsage.EdmType.BuiltInTypeKind.ToString()));
2507converted = TypeHelpers.CreateReferenceTypeUsage((EntityType)targetTypeUsage.EdmType);
2966RowType rowType = projectionType.EdmType as RowType;
2991throw EntityUtil.EntitySqlError(errCtx, Strings.PlaceholderExpressionMustBeCompatibleWithEdm64(exprName, expr.ResultType.EdmType.FullName));
4201throw EntityUtil.EntitySqlError(orderClauseItem.OrderExpr.ErrCtx, Strings.InvalidKeyTypeForCollation(keyExpr.ResultType.EdmType.FullName));
4484throw EntityUtil.EntitySqlError(Strings.InvalidUnsignedTypeForUnaryMinusOperation(argument.ResultType.EdmType.FullName));
4897exprToFilter.ResultType.EdmType.BuiltInTypeKind.ToString(),
4898exprToFilter.ResultType.EdmType.FullName));
4904exprToFilter.ResultType.EdmType.BuiltInTypeKind.ToString(),
4905exprToFilter.ResultType.EdmType.FullName));
4911typeToFilterTo.EdmType.BuiltInTypeKind.ToString(),
4912typeToFilterTo.EdmType.FullName));
4917typeToFilterTo.EdmType.BuiltInTypeKind.ToString(),
4918typeToFilterTo.EdmType.FullName));
4933throw EntityUtil.EntitySqlError(bltInExpr.ErrCtx, Strings.NotASuperOrSubType(exprToFilter.ResultType.EdmType.FullName,
4934typeToFilterTo.EdmType.FullName));
4973typeToTreatTo.EdmType.BuiltInTypeKind.ToString(),
4974typeToTreatTo.EdmType.FullName));
4980typeToTreatTo.EdmType.BuiltInTypeKind.ToString(),
4981typeToTreatTo.EdmType.FullName));
4992exprToTreat.ResultType.EdmType.BuiltInTypeKind.ToString(),
4993exprToTreat.ResultType.EdmType.FullName));
4999exprToTreat.ResultType.EdmType.BuiltInTypeKind.ToString(),
5000exprToTreat.ResultType.EdmType.FullName));
5015throw EntityUtil.EntitySqlError(bltInExpr.Arg1.ErrCtx, Strings.NotASuperOrSubType(exprToTreat.ResultType.EdmType.FullName,
5016typeToTreatTo.EdmType.FullName));
5055throw EntityUtil.EntitySqlError(bltInExpr.Arg1.ErrCtx, Strings.InvalidCast(exprToCast.ResultType.EdmType.FullName, typeToCastTo.EdmType.FullName));
5084Strings.OfTypeExpressionElementTypeMustBeEntityType(elementType.EdmType.BuiltInTypeKind.ToString(), elementType));
5089Strings.OfTypeExpressionElementTypeMustBeNominalType(elementType.EdmType.BuiltInTypeKind.ToString(), elementType));
5095Strings.TypeMustBeEntityType(Strings.CtxOfType, typeToFilterTo.EdmType.BuiltInTypeKind.ToString(), typeToFilterTo.EdmType.FullName));
5100Strings.TypeMustBeNominalType(Strings.CtxOfType, typeToFilterTo.EdmType.BuiltInTypeKind.ToString(), typeToFilterTo.EdmType.FullName));
5103if (isOnly && typeToFilterTo.EdmType.Abstract)
5105throw EntityUtil.EntitySqlError(bltInExpr.Arg2.ErrCtx, Strings.OfTypeOnlyTypeArgumentCannotBeAbstract(typeToFilterTo.EdmType.FullName));
5110throw EntityUtil.EntitySqlError(bltInExpr.Arg1.ErrCtx, Strings.NotASuperOrSubType(elementType.EdmType.FullName, typeToFilterTo.EdmType.FullName));
5219throw EntityUtil.EntitySqlError(bltInExpr.Arg1.ErrCtx, Strings.BetweenLimitsTypesAreNotCompatible(limitsExpr.Left.ResultType.EdmType.FullName, limitsExpr.Right.ResultType.EdmType.FullName));
5227throw EntityUtil.EntitySqlError(bltInExpr.Arg1.ErrCtx, Strings.BetweenLimitsTypesAreNotOrderComparable(limitsExpr.Left.ResultType.EdmType.FullName, limitsExpr.Right.ResultType.EdmType.FullName));
5244throw EntityUtil.EntitySqlError(bltInExpr.Arg1.ErrCtx, Strings.BetweenValueIsNotOrderComparable(valueExpr.ResultType.EdmType.FullName, rangeCommonType.EdmType.FullName));
System\Data\Common\EntitySql\SemanticResolver.cs (7)
602throw EntityUtil.EntitySqlError(errCtx, Strings.NotAMemberOfCollection(name, valueExpr.ResultType.EdmType.FullName));
606throw EntityUtil.EntitySqlError(errCtx, Strings.NotAMemberOfType(name, valueExpr.ResultType.EdmType.FullName));
619if (Helper.IsStructuralType(valueExpr.ResultType.EdmType))
622if (TypeResolver.Perspective.TryGetMember((StructuralType)valueExpr.ResultType.EdmType, name, _parserOptions.NameComparisonCaseInsensitive /*ignoreCase*/, out member))
654throw EntityUtil.EntitySqlError(errCtx, Strings.InvalidDeRefProperty(name, derefExprType.EdmType.FullName, valueExpr.ResultType.EdmType.FullName));
1049return !Helper.IsCollectionType(toType.EdmType);
System\Data\Mapping\DefaultObjectMappingItemCollection.cs (40)
299EdmType elemType = ConvertCSpaceToOSpaceType(((CollectionType)cdmType).TypeUsage.EdmType);
307EdmType clrPropertyType = ConvertCSpaceToOSpaceType(column.TypeUsage.EdmType);
338EdmType elemType = ConvertOSpaceToCSpaceType(((CollectionType)clrType).TypeUsage.EdmType);
346EdmType cdmPropertyType = ConvertOSpaceToCSpaceType(column.TypeUsage.EdmType);
517if (edmMember.TypeUsage.EdmType.BuiltInTypeKind != objectMember.TypeUsage.EdmType.BuiltInTypeKind)
522edmMember.TypeUsage.EdmType.Name, edmMember.TypeUsage.EdmType.BuiltInTypeKind, edmMember.Name, edmMember.DeclaringType.FullName,
523objectMember.TypeUsage.EdmType.Name, objectMember.TypeUsage.EdmType.BuiltInTypeKind, objectMember.Name, objectMember.DeclaringType.FullName));
526if (Helper.IsPrimitiveType(edmMember.TypeUsage.EdmType))
528PrimitiveType memberType = Helper.GetSpatialNormalizedPrimitiveType(edmMember.TypeUsage.EdmType);
531if (memberType.PrimitiveTypeKind != ((PrimitiveType)objectMember.TypeUsage.EdmType).PrimitiveTypeKind)
535edmMember.TypeUsage.EdmType.FullName, edmMember.Name, edmMember.DeclaringType.FullName,
536objectMember.TypeUsage.EdmType.FullName, objectMember.Name, objectMember.DeclaringType.FullName));
539else if (Helper.IsEnumType(edmMember.TypeUsage.EdmType))
542Helper.IsEnumType(objectMember.TypeUsage.EdmType),
545ValidateEnumTypeMapping((EnumType)edmMember.TypeUsage.EdmType, (EnumType)objectMember.TypeUsage.EdmType);
554edmMemberType = ((RefType)edmMember.TypeUsage.EdmType).ElementType;
555objectMemberType = ((RefType)objectMember.TypeUsage.EdmType).ElementType;
558Helper.IsCollectionType(edmMember.TypeUsage.EdmType))
560edmMemberType = ((CollectionType)edmMember.TypeUsage.EdmType).TypeUsage.EdmType;
561objectMemberType = ((CollectionType)objectMember.TypeUsage.EdmType).TypeUsage.EdmType;
565edmMemberType = edmMember.TypeUsage.EdmType;
566objectMemberType = objectMember.TypeUsage.EdmType;
572edmMember.TypeUsage.EdmType.FullName, edmMember.Name, edmMember.DeclaringType.FullName,
573objectMember.TypeUsage.EdmType.FullName, objectMember.Name, objectMember.DeclaringType.FullName));
589Helper.IsScalarType(edmProperty.TypeUsage.EdmType),
592Helper.IsScalarType(objectProperty.TypeUsage.EdmType),
635if (Helper.IsComplexType(edmMember.TypeUsage.EdmType))
769Debug.Assert(edmEnd.TypeUsage.EdmType.BuiltInTypeKind == BuiltInTypeKind.RefType, "Ends must be of Ref type");
773LoadTypeMapping(((RefType)edmEnd.TypeUsage.EdmType).ElementType,
774((RefType)objectEnd.TypeUsage.EdmType).ElementType, ocItemCollection, typeMappings);
793Debug.Assert(containingEdmMember.TypeUsage.EdmType.BuiltInTypeKind == BuiltInTypeKind.ComplexType, "edm member declaringType must be of complexType");
794Debug.Assert(containingClrMember.TypeUsage.EdmType.BuiltInTypeKind == BuiltInTypeKind.ComplexType, "clr member declaringType must be of complexType");
796ComplexType edmComplexType = (ComplexType)containingEdmMember.TypeUsage.EdmType;
797ComplexType objectComplexType = (ComplexType)containingClrMember.TypeUsage.EdmType;
System\Data\Mapping\StorageMappingItemLoader.cs (31)
1777PrimitiveType importType = Helper.AsPrimitive(importParameter.TypeUsage.EdmType);
1786PrimitiveType cspaceTargetType = (PrimitiveType)StoreItemCollection.StoreProviderManifest.GetEdmType(targetParameter.TypeUsage).EdmType;
1800var schemaErrorMessage = Helper.IsEnumType(importParameter.TypeUsage.EdmType) ?
1804importParameter.TypeUsage.EdmType.FullName,
1805Helper.GetUnderlyingEdmTypeForEnumType(importParameter.TypeUsage.EdmType).Name) :
2282functionImport.ReturnParameter.TypeUsage.EdmType.FullName,
2284sTypeTargetFunction.ReturnParameter.TypeUsage.EdmType.FullName,
2393Debug.Assert(Helper.IsPrimitiveType(cTypeColumn.TypeUsage.EdmType), "S-space columns are expected to be of a primitive type.");
2394var cPrimitiveType = (PrimitiveType)cTypeColumn.TypeUsage.EdmType;
2402Strings.Mapping_InvalidContent_ConditionMapping_InvalidPrimitiveTypeKind, column.Name, column.TypeUsage.EdmType.FullName,
2454if (!Helper.IsScalarType(property.TypeUsage.EdmType))
2883if (!Helper.IsScalarType(member.TypeUsage.EdmType))
2934memberType = member.TypeUsage.EdmType;
2944memberType = collectionType.TypeUsage.EdmType;
3142RefType endRef = end.TypeUsage.EdmType as RefType;
3238EdmType edmType = conditionMember.TypeUsage.EdmType;
3259PrimitiveType memberType = ((PrimitiveType)cspaceTypeUsage.EdmType);
3598Helper.IsScalarType(member.TypeUsage.EdmType),
3600Debug.Assert(Helper.IsPrimitiveType(columnMember.TypeUsage.EdmType), "s-space column type must be primitive");
3637if (!Object.ReferenceEquals(columnMember.TypeUsage.EdmType, storeMappedTypeUsage.EdmType))
3642storeMappedTypeUsage.EdmType.Name),
3666cSpaceMember.TypeUsage.EdmType + GetFacetsForDisplay(cSpaceMember.TypeUsage),
3669sSpaceMember.TypeUsage.EdmType + GetFacetsForDisplay(sSpaceMember.TypeUsage),
4147if (!property.TypeUsage.EdmType.Equals(complexType) &&
4148!Helper.IsSubtypeOf(property.TypeUsage.EdmType, complexType))
4289property.TypeUsage.EdmType,
4292parameter.TypeUsage.EdmType,
4404PrimitiveType rowsAffectedParameterType = (PrimitiveType)rowsAffectedParameter.TypeUsage.EdmType;
4448return Helper.IsEnumType(typeUsage.EdmType) ?
4449TypeUsage.Create(Helper.GetUnderlyingEdmTypeForEnumType(typeUsage.EdmType), typeUsage.Facets) :
System\Data\Metadata\TypeSemantics.cs (76)
111if (Helper.IsPrimitiveType(subType.EdmType) && Helper.IsPrimitiveType(superType.EdmType))
141if (toType.EdmType.EdmEquals(fromType.EdmType))
146if (Helper.IsPrimitiveType(fromType.EdmType) && Helper.IsPrimitiveType(toType.EdmType))
151else if (Helper.IsCollectionType(fromType.EdmType) && Helper.IsCollectionType(toType.EdmType))
156else if (Helper.IsEntityTypeBase(fromType.EdmType) && Helper.IsEntityTypeBase(toType.EdmType))
158return fromType.EdmType.IsSubtypeOf(toType.EdmType);
160else if (Helper.IsRefType(fromType.EdmType) && Helper.IsRefType(toType.EdmType))
165else if (Helper.IsRowType(fromType.EdmType) && Helper.IsRowType(toType.EdmType))
167return IsPromotableTo((RowType)fromType.EdmType,
168(RowType)toType.EdmType);
179Func<TypeUsage, bool> isLeaf = t => !Helper.IsTransientType(t.EdmType);
184if (Helper.IsCollectionType(t.EdmType) || Helper.IsRefType(t.EdmType))
188else if (Helper.IsRowType(t.EdmType))
190return ((RowType)t.EdmType).Properties.Select(p => p.TypeUsage);
221(Helper.IsPrimitiveType(fromType.EdmType) && Helper.IsPrimitiveType(toType.EdmType)) ||
222(Helper.IsPrimitiveType(fromType.EdmType) && Helper.IsEnumType(toType.EdmType)) ||
223(Helper.IsEnumType(fromType.EdmType) && Helper.IsPrimitiveType(toType.EdmType)) ||
224(Helper.IsEnumType(fromType.EdmType) && Helper.IsEnumType(toType.EdmType) && fromType.EdmType.Equals(toType.EdmType));
250if (Helper.IsPrimitiveType(type1.EdmType) && Helper.IsPrimitiveType(type2.EdmType))
256if (TryGetCommonType(type1.EdmType, type2.EdmType, out commonEdmType))
339return Helper.IsCollectionType(type.EdmType);
349return (BuiltInTypeKind.ComplexType == type.EdmType.BuiltInTypeKind);
359return Helper.IsEntityType(type.EdmType);
369return (BuiltInTypeKind.AssociationType == type.EdmType.BuiltInTypeKind);
381return Helper.IsEnumType(type.EdmType);
391return IsScalarType(type.EdmType);
523return Helper.IsPrimitiveType(type.EdmType);
549return Helper.IsRowType(type.EdmType);
559return Helper.IsRefType(type.EdmType);
579return IsPrimitiveType(type) && Helper.IsStrongSpatialTypeKind(((PrimitiveType)type.EdmType).PrimitiveTypeKind);
589return Helper.IsStructuralType(type.EdmType);
649return IsEqualComparable(type.EdmType);
677return IsOrderComparable(type.EdmType);
703if (Helper.IsPrimitiveType(type.EdmType))
727Debug.Assert(Helper.IsPrimitiveType(fromType.EdmType), "fromType must be primitive type");
729Debug.Assert(Helper.IsPrimitiveType(toType.EdmType), "toType must be primitive type");
731if (!IsSubTypeOf((PrimitiveType)fromType.EdmType, (PrimitiveType)toType.EdmType))
782Debug.Assert(Helper.IsPrimitiveType(fromType.EdmType), "fromType must be primitive type");
784Debug.Assert(Helper.IsPrimitiveType(toType.EdmType), "toType must be primitive type");
786if (!IsSubTypeOf((PrimitiveType)fromType.EdmType, (PrimitiveType)toType.EdmType))
851Debug.Assert(Helper.IsPrimitiveType(type1.EdmType), "type1 must be primitive type");
853Debug.Assert(Helper.IsPrimitiveType(type2.EdmType), "type2 must be primitive type");
869objectModel.ReadOnlyCollection<PrimitiveType> superTypes = GetPrimitiveCommonSuperTypes((PrimitiveType)type1.EdmType,
870(PrimitiveType)type2.EdmType);
1043if (fromType.EdmType.BuiltInTypeKind != toType.EdmType.BuiltInTypeKind)
1051if (fromType.EdmType.BuiltInTypeKind == BuiltInTypeKind.CollectionType)
1054return CompareTypes(((CollectionType)fromType.EdmType).TypeUsage,
1055((CollectionType)toType.EdmType).TypeUsage,
1058else if (fromType.EdmType.BuiltInTypeKind == BuiltInTypeKind.RefType)
1061return ((RefType)fromType.EdmType).ElementType.EdmEquals(((RefType)toType.EdmType).ElementType);
1063else if (fromType.EdmType.BuiltInTypeKind == BuiltInTypeKind.RowType)
1066RowType fromRow = (RowType)fromType.EdmType;
1067RowType toRow = (RowType)toType.EdmType;
1099return fromType.EdmType.EdmEquals(toType.EdmType);
System\Data\SqlClient\SqlGen\SqlGenerator.cs (16)
948result.Append(e.ResultType.EdmType.Name);
957result.Append(e.ResultType.EdmType.Name);
1027throw EntityUtil.NotSupported(System.Data.Entity.Strings.NoStoreTypeForEdmType(resultType.Identity, ((PrimitiveType)(resultType.EdmType)).PrimitiveTypeKind));
1842Debug.Assert(Helper.IsPrimitiveType(type.EdmType), "Type must be primitive type");
1843PrimitiveType primitiveType = type.EdmType as PrimitiveType;
1944HandleInValue(sqlBuilder, value, key.ResultType.EdmType == value.ResultType.EdmType, forceNonUnicodeOnQualifyingValues);
1964HandleInValue(sqlBuilder, value, key.ResultType.EdmType == value.ResultType.EdmType, forceNonUnicodeOnQualifyingValues);
2804bool isCastOptional = left.ResultType.EdmType == right.ResultType.EdmType;
3260RowType rowType = e.ResultType.EdmType as RowType;
3816Debug.Assert(type.EdmType.DataSpace == DataSpace.CSpace, "Type must be in cSpace");
3824Debug.Assert(Helper.IsPrimitiveType(storeTypeUsage.EdmType), "Type must be primitive type");
3826string typeName = storeTypeUsage.EdmType.Name;
3832PrimitiveTypeKind primitiveTypeKind = ((PrimitiveType)storeTypeUsage.EdmType).PrimitiveTypeKind;