Click here to Skip to main content
15,867,488 members
Articles / Entity Framework

EFProf – Profiler Tool for Entity Framework

Rate me:
Please Sign up or sign in to vote.
4.57/5 (4 votes)
11 Aug 2010CPOL2 min read 54.2K   13   6
One of the important tools in your tool arsenal when you develop with an ORM tool is a profiler. This is a review of EFProf.

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 very intuitive views/reports and supplies 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 bottlenecks 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 a 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:
    C#
    HibernatingRhinos.Profiler.Appender.EntityFramework.
    	EntityFrameworkProfiler.Initialize();
  • Now start the profiler application and then run your application and get the profiler input.

Easy as that.

Using the Tool

When you start the profiler, you will get the following screen:

EFProf Start Page

After I configured my test application and ran it, I got the following screen with all the information I needed:

EFProf After Running

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 an analysis of your code in the left menu such as:

EFProf Analysis

One feature that I really liked and made me feel like a DBA was the ability to see the query plan of the query in a visual way:

Query Plan

And of course, the ability to run your queries from the profiler:

Running Queries

The tool also supports alerts about common mistakes that you can do when you program against an ORM.

Summary

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 supplies the insight on what is going on and is a very helpful tool to have.

As a last word, since EFProf is a commercial tool, this is my opinion that is expressed in this post and I wasn’t contacted by Hibernating Rhinos.

This article was originally posted at http://feeds.feedburner.com/GilFinkBlog

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead sparXys
Israel Israel
Gil Fink is a web development expert and ASP.Net/IIS Microsoft MVP. He is the founder and owner of sparXys. He is currently consulting for various enterprises and companies, where he helps to develop Web and RIA-based solutions. He conducts lectures and workshops for individuals and enterprises who want to specialize in infrastructure and web development. He is also co-author of several Microsoft Official Courses (MOCs) and training kits, co-author of "Pro Single Page Application Development" book (Apress) and the founder of Front-End.IL Meetup. You can read his publications at his website: http://www.gilfink.net

Comments and Discussions

 
QuestionHow to configure oracle DB in EFProfiler? Pin
Member 133926484-Sep-17 3:24
Member 133926484-Sep-17 3:24 
GeneralThanks for sharing Pin
Alireza_13627-Mar-16 10:01
Alireza_13627-Mar-16 10:01 
QuestionWhere to Start the Visual Tool Pin
BeeDev20-Oct-15 9:26
BeeDev20-Oct-15 9:26 
AnswerRe: Where to Start the Visual Tool Pin
BeeDev20-Oct-15 9:37
BeeDev20-Oct-15 9:37 
GeneralGood Alternative to EFProf Pin
Sergei.Kharchenko9-Jul-13 23:46
Sergei.Kharchenko9-Jul-13 23:46 
GeneralMy vote of 4 Pin
CDFaux31-Jan-12 5:39
CDFaux31-Jan-12 5:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.