Sorting sub-entities

Apr 11 at 5:47 PM
Further to my earlier question, having returned the sub-entities belonging to a particular record, is it possible to sort then (assuming they are a collection) as part of the initial query - in this example, by descending date order for example?
var customerWithOrders = await _customerService
.Query(c => c.CustomerID == key)
.Include(x => x.Orders)
.SelectAsync()
.FirstOrDefault();
Thanks.
Apr 12 at 6:40 AM
Further research suggests that directly sorting an included collection is not supported by Entity Framework, so it looks like the options are to either sort the collection as an enumerable after the initial load, or load and sort the collection in a separate query. Either of which could be achieved by extending the underlying repository and exposing that through the service class.
Marked as answer by lelong37 on 4/16/2014 at 10:46 AM