You can include the query in a string and then save the string.
This is Nick Berardi's answer:
var result = from x in appEntities where x.id = 32 select x; var sql = ((System.Data.Objects.ObjectQuery)result).ToTraceString();
The sql generated by the query can be saved and reused.
Travis j
source share