I'm trying to use the grid to efficiently access the database. I have no need to request/query all the records when I only need a few. However, I can't seem to find a way to correctly work with IQueryable.
This post/sample (106580) uses the following code (which seems ok at first):
int pagesize = args.PageSize == 0 ? 12 : Convert.ToInt32(args.PageSize);
IEnumerable data = new NORTHWNDEntities().Orders.Take(200).ToList();
IQueryable ds = data.AsQueryable();
For this to truly work as expected - I should be able to build up an SQL statement that I then execute. But that will not work here.
Before you even start, you've already requested 200 records (without any sort of criteria) and then you begin your expressions. Those 200 records may not even have the records I want to filter.
I tried skipping that part, but it will not run. No records are returned if I try to ToList it at the end.
I'm using MVC4, ASP.NET4, 2013.1
So how does one use IQueryable (with something like EF5/6) to correctly use it's querying features.