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.
This construct can be used to retrieve tabular resultsets from the database. The expressions specified in the array initializer can be scalar, persistent or nested array expressions.
The element type of the set projected with this construct is object[] that can be indexed on the client code that processes the elements of the set. Further projection, filtering or sorting operations are not supported on the projected set.
Set<object[]> s = dd.Extent<Employee>().Select<object[]>("new object[] { this, Reports.Count }");
foreach (object[] row in s)
{
Employee e = (Employee)row[0];
Console.WriteLine("{0} {1}: {2} reports", e.FirstName, e.LastName, row[1]);
}
Other examples:
[new object[] { this, Name, Cage.Name, Cage.Keepers.Count }]extentof(Animal)
[new object[] { new object[] { x, y }, z }]...
[new object[]
{
GetSoldQuantity(year, "S"),
GetSoldQuantity(year, "L"),
GetSoldQuantity(year, "XL")
}
]extentof(Product)
Where Product.GetSoldQuantity(year, size) could be mapped as follows:
Sql.Sum([Qty]OrderLineItems[Size == size && Order.YearOrdered == year])
PredictiveCacheManager | Projection | OqlReference.Chapter5