How can I read the SQL created by Entity Framework from inside my code, as the title suggests? I'm having trouble with an error where the EF crashes because a field (a DateTime field) is generated by the database. I thought I had set it up to know that the store is generating it via StoreGeneratedPattern, but it's still crashing, so I'd like to know exactly what it's trying to push up to the database.
P.S. I've only had EF for a little over an hour. I'm leaving L2S.
Since you don't have SQL Profiler, LINQPad is the best option for you. You may make use of your current assembly.
Use a typed data context from your own assembly
, then choose your dll.
You may directly write queries against your model (or copy-paste from your code). Choose the
To examine the resulting SQL code, 'tab' underneath the query window.