Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

IS [NOT] OF

Determines whether the type of an expression is of the specified type or one of its subtypes.

expression IS [ NOT ] OF ( [ ONLY ] type)

expression
Any valid query expression to determine the type of.

NOT
Negates the EDM.Boolean result of IS OF.

ONLY
Specifies that IS OF returns true only if expression is of type type and not any of one its subtypes.

type
The type to test expression against. The type must be namespace-qualified.

true if expression is of type T and T is either a base type, or a derived type of type; null if expression is null at runtime; otherwise, false.

The expressions expression IS NOT OF (type) and expression IS NOT OF (ONLY type) are syntactically equivalent to NOT (expression IS OF (type)) and NOT (expression IS OF (ONLY type)), respectively.

The following table shows the behavior of IS OF operator over some typical- and corner patterns. All exceptions are thrown from the client side before the provider gets invoked:

 

Pattern Behavior

null IS OF (EntityType)

Throws

null IS OF (ComplexType)

Throws

null IS OF (RowType)

Throws

TREAT (null AS EntityType) IS OF (EntityType)

Returns DBNull

TREAT (null AS ComplexType) IS OF (ComplexType)

Throws

TREAT (null AS RowType) IS OF (RowType)

Throws

EntityType IS OF (EntityType)

Returns true/false

ComplexType IS OF (ComplexType)

Throws

RowType IS OF (RowType)

Throws

The following Entity SQL query uses the IS OF operator to determine the type of a query expression, and then uses the TREAT operator to convert an object of the type Course to a collection of objects of the type OnsiteCourse. The query is based on the School Model.


SELECT VALUE TREAT (course as SchoolModel.OnsiteCourse)
FROM SchoolEntities.Courses as course
WHERE course IS OF( SchoolModel.OnsiteCourse)
    




Build Date:

2012-10-01
Show:
© 2015 Microsoft