Daniel Magliola
Daniel Magliola

Reputation: 32392

DataContext.Log equivalent in Entity Framework?

In Link-2-SQL, I can use the DataContext.Log property to see the exact queries that are getting thrown to SQL Server.

Is there an equivalent to this in Entity Framework?

Upvotes: 4

Views: 1416

Answers (2)

marc_s
marc_s

Reputation: 754308

Since Entity Framework supports multiple backends (as opposed to Linq-to-SQL which is SQL Server only), you can't really get the actual SQL being sent to the backend server from EF.

In order to really see what's going on, I'd recommend firing up SQL Profiler on the SQL Server backend, and see what queries get sent its way.

See this article on Simple-Talk and possibly this video series on becoming a SQL Profiler master if you're not familiar with the SQL Profiler tool.

Marc

Upvotes: 1

Craig Stuntz
Craig Stuntz

Reputation: 126547

ObjectQuery.ToTraceString()

Upvotes: 3

Related Questions