Capture SQL Generated from Linq

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
Posts: 1
Joined: Fri 06 Feb 2015 23:04

Capture SQL Generated from Linq

Post by lhengen » Fri 06 Feb 2015 23:07

Is there a way to capture the SQL generated from LINQ queries short of capturing traffic sent to the RDBMS? This would be useful for learning LINQ by experimentation.

Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Capture SQL Generated from Linq

Post by AlexP » Mon 09 Feb 2015 12:14


Yes, you can retrieve the text of the last executed SQL query, that was generated according to the LINQ query. For this, you can execute the following code:

TDataContextUtil = class(TDataContext)

You can samples in the Demo application, in the 'Working with LINQ queries' branch.

Post Reply