Top per group: Take(1) works but FirstOrDefault() doesn't?

后端 未结 4 1963
离开以前
离开以前 2021-02-20 15:32

I\'m using EF 4.3.1... just upgraded to 4.4 (problem remains) with database-first POCO entities generated by the EF 4.x DbContext Generator. I have the following

4条回答
  •  走了就别回头了
    2021-02-20 16:14

    Today I just find out that q.OrderBy(a=>a.Customer.FirstOrDefault().Name) will not hit database if FirstOrDefault() is inside Sorting Clause.

提交回复
热议问题