We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Using IQueryable

Thread ID:

Created:

Updated:

Platform:

Replies:

108161 Apr 7,2013 12:59 PM Apr 9,2013 06:33 AM ASP.NET MVC (Classic) 2
loading
Tags: Grid
Tony Basallo
Asked On April 7, 2013 12:59 PM

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.

Tony Basallo
Replied On April 7, 2013 01:29 PM

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.

Eswari S [Syncfusion]
Replied On April 9, 2013 06:33 AM

Hi Tony,

 

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.

 

Regards,

Eswari.S


CONFIRMATION

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.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;