What is the easiest way to save a LINQ request for later use?

advertisements

I have a request for a feature to be able to save a user's search for later.

Right now I'm building LINQ statements on the fly based on what the user has specified.

So I started wondering, is there an easy way for me to simply take the query that the user built, and persist it somewhere, preferably my database, so that I can retrieve it later?

Is there some way of persisting the query as XML or perhaps JSON, and then reconstituting the query later?


Never done this before, but I've had this idea:

Rather than having the query run against your database directly, if you were to have it run against an OData endpoint, you could conceivably extract the URL that is generated as the query string, and save that URL for later use. Since OData has a well-though-out spec already, you would be able to profit from other people's labor.