次の方法で共有


IS [NOT] OF (Entity SQL)

式の型が指定の型であるか、またはそのサブタイプであるかを判断します。

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

引数

  • expression
    型を判断するための任意の有効なクエリ式。
  • NOT
    IS OF の EDM.Boolean の結果を否定します。
  • ONLY
    expressiontype 型であり、そのサブタイプでない場合に限り、IS OF が true を返すことを指定します。
  • type
    expression を判定するための型。 型は名前空間で修飾する必要があります。

戻り値

expression が型 T で、T が基本データ型または type の派生型である場合は、true となります。expression が実行時に null である場合は null となり、それ以外の場合は false となります。

解説

expression IS NOT OF (type) および expression IS NOT OF (ONLY type) 式は、構文上はそれぞれ NOT (expression IS OF (type)) および NOT (expression IS OF (ONLY type)) に相当します。

次の表に、いくつかの通常およびコーナー パターンにおける IS OF 演算子の動作を示します。 All exceptions are thrown from the client side before the provider gets invoked:

パターン 動作

null IS OF (EntityType)

スロー

null IS OF (ComplexType)

スロー

null IS OF (RowType)

スロー

TREAT (null AS EntityType) IS OF (EntityType)

DBNull を返します。

TREAT (null AS ComplexType) IS OF (ComplexType)

スロー

TREAT (null AS RowType) IS OF (RowType)

スロー

EntityType IS OF (EntityType)

true または false を返します。

ComplexType IS OF (ComplexType)

スロー

RowType IS OF (RowType)

スロー

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. クエリは、School モデル に基づいています。

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

参照

概念

Entity SQL リファレンス