Is to possible to use a group by statement to get data grouped by certain values and have that translated into the SQL so that the grouping is performed before coming back to the application?
3 Answers, 1 is accepted
0
Damyan Bogoev
Telerik team
answered on 13 Nov 2009, 06:00 PM
Hi Brendan Enrick,
Yes, Telerik OpenAccess ORM translates the group by statement into a sql query and the grouping is performed by the database server. For example, the following statement is executed on the server:
var q = from o inscope.Extent<Order>()
group o by o.OrderDate into g
select g;
Unfortunately, server-side grouping could not be performed currently on non-nullable fields (value-type fields). This is scheduled for fixing and should be available in the upcoming service pack release.
In the meantime, if you need to perform grouping on a non-nullable field, this could be done on the client by using the ToList() method. It forces the execution of the query and the grouping is done afterwards in memory: