按照EF的命令不能按照我的希望工作

时间:2011-12-23 16:23:28

标签: entity-framework-4.1 sql-order-by

如何让它正常工作?我想要order by duedate desc, type

我目前有:

billSummaryRepository.GetBillSummaries(logIn.CustomerNumber)
    .OrderByDescending(o => o.DueDate)
    .OrderBy(o => o.Type)

这有效:

BillSummaries = billSummaryRepository.GetBillSummaries(logIn.CustomerNumber)
    .OrderBy(o => o.Type)
    .OrderByDescending(o => o.DueDate)

但那有多危险?它会起作用吗?

1 个答案:

答案 0 :(得分:2)

BillSummaries = billSummaryRepository
    .GetBillSummaries(logIn.CustomerNumber)
    .OrderByDescending(o => o.DueDate)
    .ThenBy(o => o.Type);