EFProf – Profiler Tool for Entity Framework
One of the important tools in your tool arsenal when you develop with an ORM tool
is a profiler. Like SQL profiler to a SQL Server DBA an Entity Framework profiler is a must have tool to Entity Framework developer.
The main reasons to acquire such a tool are to understand what is going on underneath the hood in the query engine and for performance tuning. If you think that you can use Entity Framework without knowing what it is committing to database then you should think again. Things like select N+1 or avoiding too many joins will get back at you during runtime and kick you in the face.
EFProf is an Entity Framework profiler from Hibernating Rhinos.
It includes a very intuitive views/reports and supply a lot of valuable information about what is going on when you use Entity Framework. It also provides a lot of performance alerts which can lead you to find bottle necks or problems in writing the data access queries. Behind the tool you can find Oren Eini (Ayende) which is very known for his support for NHibernate and he brings tones of knowledge in the ORMs world to the tool.
How to Get Started with EFProf
When you want to use EFProf you first need to do the following things:
- Add reference to the HibernatingRhinos.Profiler.Appender dll in your application.
The dll can be found in the tool folder.
- In the application start you will call the following line of code:
- Now start the profiler application and then run your application and get the profiler input.
Easy as that.
Using the Tool
You can see the queries that I run at the bottom, application statistic at the left menu and more important stuff which gives you very crucial details about your running application. You can also get analysis of your code in the left menu such as:
The tool also supports alerts about common mistakes that you can do when you program against an ORM.
Profiling your application is a very important aspect for gaining better performance and learning what you are doing in code when you use a tool that you didn’t write. Blind development without understanding what is going inside a development tool is something that will get back at you after deployment. EFProf supply the insight on what is going on and is a very helpful tool to have.