IEnumerable vs IQueryable

后端 未结 4 1696
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-23 15:30

I have a query:

topics.OrderBy(x => x.Replies.Any() ? x.Replies.OrderBy(y => y.PostedDate).Last().PostedDate : x.PostedDate);

It sorts th

4条回答
  •  旧巷少年郎
    2021-01-23 16:35

    Is you context to the database still active when you try to run the code you posted? If you (or .NET) have disposed the database context you will no longer be able to access the data in the IQueryable object because the connection is lost.

    /Viktor

提交回复
热议问题