0

I am facing Problem with Entity Framework Page Load Slow issue in MVC 4.

Let me put the data and result which i needed.

in My Item Table approx 50K Rows now i need to bind item on AllItemlist.cshtml page. i used Entity Framework code for this and i call method like

private betadarlingclothesEntities2 db = new betadarlingclothesEntities2();

public ActionResult Default()
        {
 return View(db.items.ToList());
        }

but its loading page very slow. how can i solve it please suggest me.

Thanks Ashutosh

Ashutosh
  • 201
  • 4
  • 16

1 Answers1

0

in My Item Table approx 50K Rows

Of course it is slow to render, in such a situation you should use paging which user can navigate between pages and/or find specific item. Each page would have small amount of data that makes the render and transfer time acceptable. Using WebGrid might be good solution because it has paging functionality that is easy to use.

Abbas Amiri
  • 2,944
  • 1
  • 21
  • 21
  • if i use paging its still slow because in EF no way to retrieve Total count and page wise (10 rows in a page) data in a single query. – Ashutosh Nov 07 '13 at 13:12
  • if i used Custom paging in Stored Procedure. that's working faster than EF. what should i do i am really confused. – Ashutosh Nov 07 '13 at 13:19
  • The problem is not about EF, it is about rendering and transferring time. On the other hand, server side paging is easy, you need two queries, one for Total count and another for data. The http://stackoverflow.com/questions/2380413/paging-with-linq-for-objects might be helpful. – Abbas Amiri Nov 07 '13 at 13:40