You are looking for something like this
var context = new MyContext(); context.Database.Log = s => Debug.WriteLine(s);
Then, whenever the request is executed, you will see the output, for example:
var customers = context.Customers.ToList();
Open connection on 30-3-2015 13:48:03 +02: 00
SELECT [Extent1]. [Guid] AS [Guid],
[Extent1]. [FirstName] AS [FirstName],
[Extent1]. [LastName] AS [LastName],
[Extent1]. [Email] AS [Email],
[Extent1]. [Created] AS [Created]
FROM [dbo]. [Customer] AS [Extent1]
- Execution: 30-3-2015 13:48:03 +02: 00
- Completed in 0 ms with the result: SqlDataReader
Closed connection on 30-3-2015 13:48:03 +02: 00
Szeki source share