System\Data\Common\CommandTrees\ExpressionBuilder\Internal\ArgumentValidation.cs (33)
36if (!TypeSemantics.IsPolymorphicType(type))
52if (!TypeSemantics.IsStructurallyEqualOrPromotableTo(expression.ResultType, requiredResultType))
106if (!TypeSemantics.IsReferenceType(endType))
124else if (!TypeSemantics.IsStructurallyEqualOrPromotableTo(from.ResultType.EdmType, endType.EdmType))
134if (!TypeSemantics.IsCollectionType(argument.ResultType))
144if (!TypeSemantics.IsCollectionType(left.ResultType) || !TypeSemantics.IsCollectionType(right.ResultType))
333if (!TypeSemantics.IsAggregateFunction(function) || null == function.ReturnParameter)
381if (!TypeSemantics.IsPrimitiveType(key.ResultType, PrimitiveTypeKind.String))
688if (!TypeSemantics.IsIntegerNumericType(count.ResultType))
833if (null == resultType || !TypeSemantics.IsPrimitiveType(resultType, PrimitiveTypeKind.Boolean))
844if (null == resultType || !TypeSemantics.IsPrimitiveType(resultType, PrimitiveTypeKind.Boolean))
859if (!TypeSemantics.IsPrimitiveType(argument.ResultType, PrimitiveTypeKind.Boolean))
875if (!TypeSemantics.IsNumericType(resultType))
881if (TypeSemantics.IsUnsignedNumericType(argument.ResultType))
899if (null == resultType || !TypeSemantics.IsNumericType(resultType))
924equality = TypeSemantics.IsEqualComparableTo(left.ResultType, right.ResultType);
925order = TypeSemantics.IsOrderComparableTo(left.ResultType, right.ResultType);
930equality = TypeSemantics.IsEqualComparableTo(left.ResultType, right.ResultType);
934order = TypeSemantics.IsOrderComparableTo(left.ResultType, right.ResultType);
957if (TypeSemantics.IsCollectionType(argument.ResultType))
968if (!allowRowType || !TypeSemantics.IsRowType(argument.ResultType))
1009if (!TypeSemantics.IsCastAllowed(argument.ResultType, toType))
1027if (!TypeSemantics.IsValidPolymorphicCast(argument.ResultType, asType))
1053!TypeSemantics.IsValidPolymorphicCast(elementType, type))
1077if (!TypeSemantics.IsValidPolymorphicCast(argument.ResultType, type))
1136if (!TypeSemantics.IsValidPolymorphicCast(entitySet.ElementType, entityType))
1176if (!TypeSemantics.IsValidPolymorphicCast(entitySet.ElementType, entityType))
1379if (!TypeSemantics.IsIntegerNumericType(limit.ResultType))
1536commonElementType = TypeSemantics.GetCommonType(commonElementType, exp.ResultType);
1554if (!TypeSemantics.IsCollectionType(collectionType))
2022if (!TypeSemantics.IsReferenceType(retType))
2057TypeSemantics.IsIntegerNumericType(expression.ResultType) &&
System\Data\Common\CommandTrees\OperatorExpressions.cs (16)
32Debug.Assert(TypeSemantics.IsPrimitiveType(booleanResultType, PrimitiveTypeKind.Boolean), "DbAndExpression requires a Boolean result type");
62Debug.Assert(TypeSemantics.IsPrimitiveType(booleanResultType, PrimitiveTypeKind.Boolean), "DbOrExpression requires a Boolean result type");
92Debug.Assert(TypeSemantics.IsPrimitiveType(booleanResultType, PrimitiveTypeKind.Boolean), "DbNotExpression requires a Boolean result type");
125Debug.Assert(TypeSemantics.IsNumericType(numericResultType), "DbArithmeticExpression result type must be numeric");
239Debug.Assert(TypeSemantics.IsCastAllowed(argument.ResultType, type), "DbCastExpression represents an invalid cast");
276Debug.Assert(TypeSemantics.IsBooleanType(booleanResultType), "DbComparisonExpression result type must be a Boolean type");
314Debug.Assert(TypeSemantics.IsBooleanType(booleanResultType), "DbIsEmptyExpression requires a Boolean result type");
343Debug.Assert(TypeSemantics.IsBooleanType(booleanResultType), "DbIsNullExpression requires a Boolean result type");
375Debug.Assert(TypeSemantics.IsBooleanType(booleanResultType), "DbIsOfExpression requires a Boolean result type");
460Debug.Assert(TypeSemantics.IsValidPolymorphicCast(argument.ResultType, asType), "DbTreatExpression represents an invalid treat");
496Debug.Assert(TypeSemantics.IsPrimitiveType(input.ResultType, PrimitiveTypeKind.String), "DbLikeExpression argument must have a string result type");
497Debug.Assert(TypeSemantics.IsPrimitiveType(pattern.ResultType, PrimitiveTypeKind.String), "DbLikeExpression pattern must have a string result type");
498Debug.Assert(TypeSemantics.IsPrimitiveType(escape.ResultType, PrimitiveTypeKind.String), "DbLikeExpression escape must have a string result type");
499Debug.Assert(TypeSemantics.IsBooleanType(booleanResultType), "DbLikeExpression must have a Boolean result type");
547Debug.Assert(TypeSemantics.IsReferenceType(refResultType), "DbEntityRefExpression requires a reference result type");
576Debug.Assert(TypeSemantics.IsRowType(rowResultType), "DbRefKeyExpression requires a row result type");
System\Data\Common\EntitySql\SemanticAnalyzer.cs (77)
972if (!TypeSemantics.IsComplexType(metadataType.TypeUsage) &&
973!TypeSemantics.IsEntityType(metadataType.TypeUsage) &&
974!TypeSemantics.IsRelationshipType(metadataType.TypeUsage))
1051if (TypeSemantics.IsAggregateFunction(metadataFunctionGroup.FunctionMetadata[0]) && sr.IsInAnyGroupScope())
1275argTypes.Zip(aggArgTypes).All(types => types.Key == null && types.Value == null || TypeSemantics.IsStructurallyEqual(types.Key, types.Value)),
1283Debug.Assert(TypeSemantics.IsCollectionType(functionType.Parameters[0].TypeUsage), "functionType.Parameters[0].Type is CollectionType");
1330Debug.Assert(TypeSemantics.IsComplexType(type) || TypeSemantics.IsEntityType(type) || TypeSemantics.IsRelationshipType(type), "type must have a constructor");
1372bool isPromotable = TypeSemantics.IsPromotableTo(args[idx].ResultType, memberModelTypeUsage);
1376if (!isPromotable && !TypeSemantics.IsPromotableTo(memberModelTypeUsage, args[idx].ResultType))
1386!TypeSemantics.IsSubTypeOf(args[idx].ResultType, memberModelTypeUsage))
1599if (!TypeSemantics.IsStructurallyEqualOrPromotableTo(refType, toEnd.TypeUsage.EdmType))
1607.Where (e => TypeSemantics.IsStructurallyEqualOrPromotableTo(refType, e.TypeUsage.EdmType) &&
1634if (!TypeSemantics.IsStructurallyEqualOrPromotableTo(driverEntityType.GetReferenceType(), fromEnd.TypeUsage.EdmType))
1647.Where(e => TypeSemantics.IsStructurallyEqualOrPromotableTo(driverEntityType.GetReferenceType(), e.TypeUsage.EdmType) &&
1734if (!TypeSemantics.IsStructurallyEqualOrPromotableTo(sourceRefType, fromEnd.TypeUsage.EdmType))
1747.Where (e => TypeSemantics.IsStructurallyEqualOrPromotableTo(sourceRefType, e.TypeUsage.EdmType) &&
1805if (!TypeSemantics.IsEntityType(converted.ResultType))
1833if (!TypeSemantics.IsReferenceType(converted.ResultType))
1889if (!TypeSemantics.IsStructurallyEqualOrPromotableTo(keyRowExpression.ResultType, TypeUsage.Create(entityKeyRowType)))
1904if (!TypeSemantics.IsEntityType(targetTypeUsage))
1913if (!TypeSemantics.IsValidPolymorphicCast(entitySet.ElementType, targetTypeUsage.EdmType))
1945if (TypeSemantics.IsEntityType(converted.ResultType))
1949else if (!TypeSemantics.IsReferenceType(converted.ResultType))
1991if (!TypeSemantics.IsNumericType(operands.Left.ResultType))
1998if (!TypeSemantics.IsNumericType(operands.Right.ResultType))
2028if (!TypeSemantics.IsNumericType(operands.Left.ResultType) && !TypeSemantics.IsPrimitiveType(operands.Left.ResultType, PrimitiveTypeKind.String))
2033if (!TypeSemantics.IsNumericType(operands.Right.ResultType) && !TypeSemantics.IsPrimitiveType(operands.Right.ResultType, PrimitiveTypeKind.String))
2111if (!TypeSemantics.IsEqualComparableTo(compArgs.Left.ResultType, compArgs.Right.ResultType))
2138if (!TypeSemantics.IsOrderComparableTo(compArgs.Left.ResultType, compArgs.Right.ResultType))
2173if (!TypeSemantics.IsCollectionType(leftExpr.ResultType))
2186if (!TypeSemantics.IsCollectionType(rightExpr.ResultType))
2194if (!TypeSemantics.TryGetCommonType(leftElemType, rightElemType, out commonType))
2247if (!TypeSemantics.IsCollectionType(leftExpr.ResultType))
2274if (!TypeSemantics.IsCollectionType(rightExpr.ResultType))
2290if (TypeSemantics.IsCollectionType(leftExpr.ResultType))
2309if (TypeSemantics.IsCollectionType(type))
2498if (!TypeSemantics.IsEntityType(targetTypeUsage))
2691if (caseExpr.ElseExpr == null && TypeSemantics.IsCollectionType(resultType))
2964if (projectionItemErrCtxs != null && TypeSemantics.IsRowType(projectionType))
2989if (!TypeSemantics.IsPromotableTo(expr.ResultType, sr.TypeResolver.Int64Type))
3087if (!TypeSemantics.IsCollectionType(converted.ResultType))
3963Debug.Assert(TypeSemantics.IsCollectionType(lambdaVariable.ResultType));
3971TypeSemantics.IsRowType(projectExpression.Projection.ResultType))
3973if (!TypeSemantics.IsEqual(projectExpression.Projection.ResultType, projectExpression.Input.Variable.ResultType))
4326return TypeSemantics.IsPrimitiveType(type, PrimitiveTypeKind.String);
4331return TypeSemantics.IsPrimitiveType(type, PrimitiveTypeKind.Boolean);
4336return TypeSemantics.IsStructurallyEqual(type1, type2) || type1.IsSubtypeOf(type2) || type2.IsSubtypeOf(type1);
4387if (TypeSemantics.IsNumericType(args.Left.ResultType))
4479if (TypeSemantics.IsUnsignedNumericType(argument.ResultType))
4726if (!TypeSemantics.IsCollectionType(elemExpr.ResultType))
4731if (!TypeSemantics.IsCollectionType(TypeHelpers.GetElementTypeUsage(elemExpr.ResultType)))
4893if (!isNominalTypeAllowed && !TypeSemantics.IsEntityType(exprToFilter.ResultType))
4900else if (isNominalTypeAllowed && !TypeSemantics.IsNominalType(exprToFilter.ResultType))
4908if (!isNominalTypeAllowed && !TypeSemantics.IsEntityType(typeToFilterTo))
4914else if (isNominalTypeAllowed && !TypeSemantics.IsNominalType(typeToFilterTo))
4921if (!TypeSemantics.IsPolymorphicType(exprToFilter.ResultType))
4926if (!TypeSemantics.IsPolymorphicType(typeToFilterTo))
4969if (!isNominalTypeAllowed && !TypeSemantics.IsEntityType(typeToTreatTo))
4976else if (isNominalTypeAllowed && !TypeSemantics.IsNominalType(typeToTreatTo))
4988else if (!isNominalTypeAllowed && !TypeSemantics.IsEntityType(exprToTreat.ResultType))
4995else if (isNominalTypeAllowed && !TypeSemantics.IsNominalType(exprToTreat.ResultType))
5003if (!TypeSemantics.IsPolymorphicType(exprToTreat.ResultType))
5008if (!TypeSemantics.IsPolymorphicType(typeToTreatTo))
5035if (!TypeSemantics.IsScalarType(typeToCastTo))
5048if (!TypeSemantics.IsScalarType(exprToCast.ResultType))
5053if (!TypeSemantics.IsCastAllowed(exprToCast.ResultType, typeToCastTo))
5075if (!TypeSemantics.IsCollectionType(exprToFilter.ResultType))
5081if (!isNominalTypeAllowed && !TypeSemantics.IsEntityType(elementType))
5086else if (isNominalTypeAllowed && !TypeSemantics.IsNominalType(elementType))
5092if (!isNominalTypeAllowed && !TypeSemantics.IsEntityType(typeToFilterTo))
5097else if (isNominalTypeAllowed && !TypeSemantics.IsNominalType(typeToFilterTo))
5225if (!TypeSemantics.IsOrderComparableTo(limitsExpr.Left.ResultType, limitsExpr.Right.ResultType))
5242if (!TypeSemantics.IsOrderComparableTo(valueExpr.ResultType, rangeCommonType))
System\Data\Mapping\FunctionImportMappingComposable.cs (10)
48MetadataHelper.TryGetFunctionImportReturnType<EdmType>(functionImport, 0, out resultType) && TypeSemantics.IsScalarType(resultType),
125Debug.Assert(TypeSemantics.IsPromotableTo(functionViewType, this.FunctionImport.ReturnParameter.TypeUsage), "Mapping expression result type must be promotable to the c-space function return type.");
155if (TypeSemantics.IsEnumerationType(argumentNode.Op.Type))
162Debug.Assert(TypeSemantics.IsPromotableTo(argumentNode.Op.Type, commandParam.ResultType), "Argument type must be promotable to parameter type.");
229TypeSemantics.IsPromotableTo(queryExpression.ResultType, this.FunctionImport.ReturnParameter.TypeUsage),
236TypeSemantics.IsEqual(queryExpression.ResultType, this.FunctionImport.ReturnParameter.TypeUsage),
417if (!TypeSemantics.IsEqual(accessorExpr.ResultType, edmProperty.TypeUsage))
444Debug.Assert(TypeSemantics.IsCollectionType(queryExpression.ResultType), "Store function must be TVF (collection expected).");
446Debug.Assert(TypeSemantics.IsRowType(collectionType.TypeUsage), "Store function must be TVF (collection of rows expected).");
453if (TypeSemantics.IsEqual(functionImportReturnType.TypeUsage, column.TypeUsage))
System\Data\Metadata\TypeHelpers.cs (30)
37if (TypeSemantics.IsCollectionType(typeUsage))
41else if (TypeSemantics.IsStructuralType(typeUsage) && !Helper.IsComplexType(typeUsage.EdmType) && !Helper.IsEntityType(typeUsage.EdmType))
48else if (TypeSemantics.IsPrimitiveType(typeUsage))
86if (TypeSemantics.IsRowType(typeUsage))
100return TypeSemantics.IsOrderComparable(typeUsage);
138else if (TypeSemantics.IsRowType(typeUsage))
160return TypeSemantics.IsReferenceType(typeUsage) ||
161TypeSemantics.IsEntityType(typeUsage) ||
162TypeSemantics.IsScalarType(typeUsage);
168return TypeSemantics.IsReferenceType(typeUsage) ||
169TypeSemantics.IsEntityType(typeUsage) ||
170TypeSemantics.IsScalarType(typeUsage);
175return TypeSemantics.GetCommonType(typeUsage1, typeUsage2);
194commonType = TypeSemantics.GetCommonType(commonType, testType);
276if (!TypeSemantics.IsPrimitiveType(type, PrimitiveTypeKind.String) &&
277!TypeSemantics.IsPrimitiveType(type, PrimitiveTypeKind.Binary))
289if (!TypeSemantics.IsPrimitiveType(type, PrimitiveTypeKind.String))
306if (!TypeSemantics.IsPrimitiveType(type, PrimitiveTypeKind.String) &&
307!TypeSemantics.IsPrimitiveType(type, PrimitiveTypeKind.Binary))
319if (!TypeSemantics.IsPrimitiveType(type, PrimitiveTypeKind.Decimal))
330if (!TypeSemantics.IsPrimitiveType(type, PrimitiveTypeKind.Decimal))
445Debug.Assert(TypeSemantics.IsScalarType(scalarType), "Primitive or enum type expected.");
447return TypeSemantics.IsEnumerationType(scalarType) ?
460Debug.Assert(TypeSemantics.IsEnumerationType(enumTypeUsage), "enumTypeUsage is not an enumerated type");
473Debug.Assert(TypeSemantics.IsStrongSpatialType(spatialTypeUsage), "spatialTypeUsage is not a strong spatial type");
569if (TypeSemantics.IsCollectionType(type))
573else if (TypeSemantics.IsReferenceType(type))
586if (tvf.ReturnParameter != null && TypeSemantics.IsCollectionType(tvf.ReturnParameter.TypeUsage))
589if (TypeSemantics.IsRowType(expectedElementTypeUsage))
770if (!TypeSemantics.IsIntegerNumericType(valueType))
System\Data\SqlClient\SqlGen\SqlFunctionCallHandler.cs (7)
449string functionNameWithSrid = (TypeSemantics.IsPrimitiveType(functionExpression.ResultType, PrimitiveTypeKind.Geometry) ? "geometry::STGeomFromText" : "geography::STGeomFromText");
450string functionNameWithoutSrid = (TypeSemantics.IsPrimitiveType(functionExpression.ResultType, PrimitiveTypeKind.Geometry) ? "geometry::Parse" : "geography::Parse");
466return HandleSpatialStaticMethodFunctionAppendSrid(sqlgen, functionExpression, (TypeSemantics.IsPrimitiveType(functionExpression.ResultType, PrimitiveTypeKind.Geometry) ? "geometry::GeomFromGml" : "geography::GeomFromGml"));
471return HandleSpatialStaticMethodFunctionAppendSrid(sqlgen, functionExpression, (TypeSemantics.IsPrimitiveType(functionExpression.ResultType, PrimitiveTypeKind.Geometry) ? "geometry::STGeomFromWKB" : "geography::STGeomFromWKB"));
485DbExpression sridExpression = (TypeSemantics.IsPrimitiveType(functionExpression.ResultType, PrimitiveTypeKind.Geometry) ? defaultGeometrySridExpression : defaultGeographySridExpression);
1448if (TypeSemantics.IsPrimitiveType(e.Arguments[0].ResultType, PrimitiveTypeKind.Byte))
1818if (TypeSemantics.IsPrimitiveType(e.Arguments[i].ResultType, type))