我一直在尋找代碼,如果我可以分頁EF中的大數據,例如從1到100 ...或更多,Web應用程序真的很慢。 我在這裏有代碼,但我還找不到解決方案。實體框架分頁
我真的需要使頁面中的數據或使數據視圖更快 記錄超過(1,5000,000)記錄。 請大家如果有人有EF分頁的任何代碼或解決方案或數據可以更快地回覆我。
謝謝你們,
[代碼]
var openComplaintsAssignedToOffice = individual.Office.AssignedComplaints
.ToArray()
.Where(n => n.Individuals.Any(e => e.Employed))
.ToArray() ;
if (!complaintModel.ShowClosedComplaints)
{
openComplaintsAssignedToOffice = openComplaintsAssignedToOffice.Where(c => c.CurrentStatus != ComplaintStatus.Closed)
.ToArray();
}
complaintModel.OpenComplaintsAssignedToMyOffice = openComplaintsAssignedToOffice.OrderByDescending(c => c.UpdatedDateTime)
.ToArray();
complaintModel.OpenComplaintsAssignedToMyOffice = openComplaintsAssignedToOffice.OrderByDescending(c => c.UpdatedDateTime)
.ToArray();
return complaintModel;
你只是尋找'.Skip()'和'。取()'功能? – David
你正在提出一個非常微不足道的問題,並附帶代碼,這些代碼似乎並不相關。或者,更確切地說,代碼似乎會導致問題本身。 –
http://sqlperformance.com/2015/01/t-sql-queries/pagination-with-offset-fetch – ErikEJ