I want to get the translated Linq query programmatically and do some stuff with that Sql syntax.
Suppose this is my code:
public class MyApiControlle
I think these posts may help you:
1) How to view LINQ Generated SQL statements?
2) How do I view the SQL generated by the Entity Framework?
Couple of examples (from the above):
var sql = ((System.Data.Objects.ObjectQuery)objs).ToTraceString();
var sql = objs.ToString();
Documentation on .ToTraceString()
can be found here:
MSDN trace string documentation