score:0

The query should be re-written as

var orders = from order in context.Orders
             select new
             {
                 reference = order.reference,
                 OrderExecutions = order.OrderExecutions //this is an EntityCollection
              };

There is no need to convert to IEnumerable and then re-select the same fields. And then there is no need to convert to a List, then back to an IQueryable, because a LINQ query naturally returns an IQueryable object. By calling ToList() the query is executed against the data source. It's almost always better to defer those calls until after any additional restrictions have been put into place.


Related Query

More Query from same tag