未加载“订单”属性!如何更改此代码以加载属性“订单”然后获取其计数以便我可以使用它进行排序?
IOrderedQueryable<Event> orderedQuery = (paging.SortDirection == SortDirection.Ascending)
? searchQuery.ToList().AsQueryable<Event>().OrderBy(e => e.Orders.Count)
: searchQuery.ToList()
.AsQueryable<Event>()
.OrderByDescending(e => e.Orders.Count);