score:2

Accepted answer

doing something like that is not simple. have a look at the series of articles building an iqueryable provider by matt warren. all the code he uses is available as a library too. that should help you get started.

score:0

check out the method datacontext.getcommand() which is passed an iqueryable object and returns the dbcommand object that corresponds to the query. the commandtext property of the dbcommand object shows the text of the query.

score:1

you could write an expression tree parser and generate the sql. your description contains a fault - myquery isn't iqueryable<cat>, it is an ienumerable<cat>. as you tagged it correctly, this is linq-to-objects, not linq-to-sql. there is no information in the calls to construct a query.


Related Query

More Query from same tag