IQueryable<Entity> query = (from e in Context.Set<TEntity>() select e);
IEnumerable<TEntity> result = query.OrderBy(x=>x.Property).Skip(10).Take(10);
的排序依據/跳躍/送返回IEnumerable<T>
。我擔心會發生什麼,所有的結果將被返回,然後Linq將被用來只採取其中的一部分。
我的問題是:OrderBy/Skip和Take是否包含在已發佈的SQL查詢中,以便只返回總結果的請求子集?
您是否在嘗試監視SQL Server時嘗試過? [一些見解](http://stackoverflow.com/questions/23822878/entity-framework-skip-take-functionality)。 – BCdotWEB 2014-11-03 10:37:06
IQueryable被編譯爲sql。所以,是的,只返回總結果的請求子集 – 2014-11-03 10:37:12
作爲一個側面主題,我建議你閱讀關於延期執行的內容。 http://blogs.msdn.com/b/charlie/archive/2007/12/09/deferred-execution.aspx – 2014-11-03 10:42:16