Many of us might have heard about SQL profiler, similarly entity framework also has a tool named as entity framework profiler. It is not free but it is well worth its price.
Once you install it then a namespace automatically gets added to your visual studio environment. In case you are developing a window based application then you will have to write the following code inside the man() function and if you are using a web based application then you will have to declare this in global.asax.
Dont forget to add refrences to Dlls from Entity framework profiler:
Now put a breakpoint over foreachloop in your code as shown below:
Now open your entity framework profile as shown below:
Voila! It shows you what query is running against your database.