eg.
var result = myObject.Where(x => x.prop == 5);
string s = result.toSQL();
Result:
s
is "SELECT * FROM [myObjects] WHERE prop = 5"
If it's IQueryable
/ObjectQuery
you can use ToTraceString
. If it's IDbSet/DbSet you can use ToString
directly.