entity framework profiler,profiler,.net framework, asp.net 4.0, asp.net tutorials, c#, Code generation, classes, database design, Database, Entity Framework,

 

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.

As follows: 

Dont forget to add refrences to Dlls from Entity framework profiler:

HibernatingRhino.profiler.appender.dll,HibernatingRhino.profiler.Integration.dll

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.