|108161||Apr 7,2013 04:59 PM UTC||Apr 9,2013 10:33 AM UTC||ASP.NET MVC (Classic)||2|
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.
It seems I can get what I expect - build up a SQL state and execute just that by finishing up with this:
ds1 = (IQueryable<T>)ds;
Where T is the type being returned. This works perfect.
Not sure how this applies to other ORMs, but with EF, this works as expected.
Thanks for your interest in Syncfusion products.
We have provided response to your query in the incident 106696.
Could you please follow up with the incident.
Please let us know if you have any queries.
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.