This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
The following query: uow.Ticks.OrderByDescending(t => t.Time).Take(5).OrderBy(t => t.Time) Results in the first 5 ticks instead of the last 5 ticks. LightSpeed is most likely combining the OrderByDescending and OrderBy and performing a 'TOP 5' on the result of the two OrderBy's. The above LINQ query works as expected in Linq2SQL. Note, the above was tested on SQL Server 2005. |
|
|
Yes thats right, we dont automatically split the query into sub-queries so you are actually applying Id, Id desc as the ordering to the query. We do have a backlog item for 5.0 to look at improving this as the behavior now does conflict with what other LINQ implementations would do. For now you can handle this by using the query based approach which allows you to precisely describe how to partition this into a sub-query. e.g.
|
|