I swear I’ve seen how to do this before, but now that I actually need to do it I can’t remember where I saw it at. I need two different things —
1) to see the actual SQL query that is generated by a LINQ query and
2) when the SQL query actually hits the database to do whatever (CRUD operations)
Is there a tool that will allow me to do this?
EDIT:
Sorry, should have given more detail.
— LINQ to Entities is what I’m using.
— Also, I don’t have admin rights on our instance of SQL Server, so I can’t use SQL Profiler. I could always call the DBA and have them do it for me, but it’s a hassle. I should have mentioned that and I apologize. What I really want is a tool that I can use on my own box that will allow me to see when a LINQ query hits the database while I am in debug mode (debugging and stepping through the code).
Try using SQL Profiler. It’s great for seeing what LINQ to SQL is generating.
LINQPad is also a great tool for writing linq and sql statements for testing.