Paging with Entity Framework

Nov 26, 2010 at 9:36 AM

I is possible using a Mvcpager with Entity Framework?

I took the test but giving this error.

Only managed to do using LINQ to Class

Jan 22, 2011 at 8:13 AM

hi there,

I solve your problem, it's kind of simple.

You just need to OrderBy once => DONE

PagedList<Comment> comments = storeDB.Comments
                .Where(c => c.VideoId == videoId)
                .OrderByDescending(c => c.DateCreated)
                .ToPagedList(pageIndex ?? 1, PageSize);

Cheer !