UNIONquery; A value of UnionMethod.CrossFilter instructs the query engine to conduct a cross-filtered union query. The value of this modifier only has effects on query execution performance and may be ignored by the query engine if the specified behaviour is not applicable in certain scenarios.
A Set<T> containing all elements of set1 and set2.
The union operator returns a Set<T> containing all elements of set1 and set2. The element type of the resulting set is the most specialised common type of the element type of set1 and set2 (the current implementation restricts set1 and set2 to having the same element type, hence the element type of the resulting Set<T> is identical to the element type of both source sets).
The query used to enumerate the elements of the resulting Set<T> can be conducted in multiple ways by the query engine. If set1 and set2 have the same element type and both have the same or no projections applied, then the resulting set is defined by the query
[projection]extentof(T)[filter1 || filter2]
where projection is the same projection applied to both sets, T is the element type of the source sets, filter1 is the filter criteria (if any) applied to set1 and filter2 is the filter criteria applied to set2. This method of conducting the resulting query is referred to as cross-filtering set1 with set2.
[Age]extentof(Person)[Name=="John Doe"] + [Age]extentof(Person)[Name=="Foo Bar"]
SELECT Age FROM Person WHERE Name='John Doe' OR Name='Foo Bar'
The query engine always tries to produce cross-filtered unions wherever possible, unless otherwise directed by union-hint.
If set1 and set2 are of the same element type but the conditions defined above do not
apply, a standard T-SQL
UNION query is generated if the underlying relational database server supports it.
Hence, the following OQL expression
[Age]extentof(Person)[Age > 25] + [Age]extentof(CompanyCar)[Age < 5]
(SELECT Age FROM Person WHERE Age > 25) UNION (SELECT Age FROM CompanyCar WHERE Age < 5)