DEREF
Dereferences a reference value and produces the result of that dereference.
SELECT DEREF ( o.expression ) from Table as o;
Arguments
- expression
Any valid query expression that returns a collection.
Return Value
The value of the entity that is referenced.
Remarks
The DEREF operator dereferences a reference value and produces the result of that dereference. For example, ifr
is a reference of type ref<T>, Deref
(r)
is an expression of typeT
that yields the entity referenced by r
. If the reference value is null, or is dangling (that is, the target of the reference does not exist), the result of the DEREF operator is null.
Example
The following Entity SQL query uses the DEREF operator to dereference a reference value and produce the result of that dereference. The query is based on the AdventureWorks Sales Model. To compile and run this query, follow these steps:
Follow the procedure in How to: Execute a Query that Returns PrimitiveType Results.
Pass the following query as an argument to the ExecutePrimitiveTypeQuery method:
SELECT VALUE DEREF(REF(p)).Name FROM AdventureWorksEntities.Products
as p