TechTalk Genome v4.2

Projection

[[alias:] select-clause [distinct]]set
alias
An identifier used to alias the candidate element of set. If alias is specified, the this keyword refers to the candidate element declared in any outer scope (the semantics of the this keyword are not altered when an explicit alias is used). If omitted, the this keyword can be used to refer to the candidate element of set.
select-clause
An OQL implicit function executed on candidate elements of set, returning a scalar, persistent, transient or object array expression. The return value of select-clause is stored in the resulting Set<T>. alias (if declared) can be used to refer to the candidate element of set. Identifiers declared in outer scopes of the expression can be freely used within select-clause.
distinct
If specified, the resulting set contains only distinct values.
set
An OQL expression returning a Set<T> of scalars or persistent objects.

Return Value

A Set<T> containing return values of select-clause evaluated for all elements of set.

Remarks

The select-clause expression is evaluated for each element of set and the results of this evaluation are stored in the resulting Set<T> returned by this expression. If the distinct keyword is specified, the resulting set contains each element only once; otherwise, the count of elements returned in the resulting set is identical to the count of set.

alias (if present) can be used to refer to the candidate element of set; otherwise, the this keyword can be used.

OQL accords filtering a higher operator precedence than projection. Therefore, the query

    [projection]set[filter] 

is identical to

    [projection](set[filter]) 

Quick Reference

OQL
[Cage]extentof(Animal)


[Cage distinct]extentof(Animal)

C#
Set<Cage> cages = myDB.Extent<Animal>().Select<Cage>("Cage");


Set<Cage> cages = myDB.Extent<Animal>().Select<Cage>(true, "Cage");

SQL
SELECT Cage.* FROM Animal LEFT OUTER JOIN Cage ON Animal.CageId = Cage.Id


SELECT DISTINCT Cage.* FROM Animal LEFT OUTER JOIN Cage ON Animal.CageId = Cage.Id

See Also

Set<T>.Select<S> | Implicit Functions | Filtering | OqlReference.Chapter5