views:

152

answers:

2

I need to convert a Session object to an IOrderedQueryable and came up blank. I've thought of creating a wrapper, but its not working properly. Basically, I am pulling a Linq query and would like to store it so that I don't have to pull it each time I visit. There are up to 7-10 parameters per user so it's not something that's great for caching.

+1  A: 

I can simply cast my Session object as an IOrderedQueryable like:

(IOrderedQueryable<T>)Session["myObject"];
Jason N. Gaylord
A: 

It seems you want to store the data returned by the linq query, if that's the case you need to make it grab the data i.e. by using .ToList() and storing that.

eglasius