Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serializing IQueryable<T> to session state server

How can I store a LINQ query (i.e. of type IQueryable<T>) in SQL Server session state or any other State Server?

like image 854
Syam Avatar asked Mar 15 '26 21:03

Syam


2 Answers

You can't serialize the IQueryable but you may be able to serialize the expression tree which generates that IQueryable. Check out the following question and associated MSDN link.

Can you Pass Func<T,bool> Through a WCF Service?

http://archive.msdn.microsoft.com/exprserialization

like image 182
Kirk Broadhurst Avatar answered Mar 18 '26 09:03

Kirk Broadhurst


You can serialize/deserialize manually the Expression that is associated to IQueriable using the visitor

Or check here: http://archive.msdn.microsoft.com/exprserialization

like image 44
Nicolae Dascalu Avatar answered Mar 18 '26 11:03

Nicolae Dascalu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!