Entity SQL supports a number of types:
Primitive (simple) types such as Int32 and String.
Nominal types that are defined in the schema, such as EntityType, ComplexType, and RelationshipType.
Anonymous types that are not defined in the schema explicitly: CollectionType, RowType, and RefType.
This section discusses the anonymous types that are not defined in the schema explicitly but are supported by Entity SQL. For information on primitive and nominal types, see EDM Types.
The structure of a row depends on the sequence of typed and named members that the row consists of. A row type has no identity and cannot be inherited from. Instances of the same row type are equivalent if the members are respectively equivalent. Rows have no behavior beyond their structural equivalence and have no equivalent in the common language runtime. Queries can result in structures that contain rows or collections of rows. The API binding between the Entity SQL queries and the host language defines how rows are realized in the query that produced the result. For information on how to construct a row instance, see Constructing Types.
Collection types represent zero or more instances of other objects. For information on how to construct collection, see Constructing Types.
A reference is a logical pointer to a specific entity in a specific entity set.
Entity SQL supports the following operators to construct, deconstruct, and navigate through references:
You can navigate through a reference by using the member access (dot) operator(
.). The following snippet extracts the Id property (of Order) by navigating through the r (reference) property.
select o2.r.Id from (select ref(o) as r from LOB.Orders as o) as o2
If the reference value is null, or if the target of the reference does not exist, the result is null.