Archive

Archive for March 22nd, 2009

A Profiler for the Entity Framework - Proposed

March 22nd, 2009 Simon Segal 1 comment

The .ToTraceString() method and the SQL Server Profiler are just too disconnected to provide me with a solution to analysing and logging the SQL Query output produced by my Entity Framework code. To change that, I am currently working on a profiler for the Entity Framework. Of course the inspiration to start on this project came from watching what Ayende was doing with NHProf (which is incredible), however I should point out that this project does not seek in any way nor set out to accomplish the same goals, it is my attempt at building myself a usable tool for a job and if it can anyone else then that’s great too. Here is the list requirements I am starting with:

  • UI for presenting SQL Statements and contextual Entity Framework Meta Data from the ObjectContext that created the query.
  • Entity Framework ObjectContext’s will need to opt in for profiling.
  • Saving of session profiling data to disk in a format that can be re-read and displayed  for later analysis.

So as you can see, I have kept it a pretty small list with a view to getting the basics done ef_profiler_early_layoutquickly. I have already decided that this project will not attempt to profile .NET executables working sets, however for reasons that will limit my current approach, I will consider using the Profiler API for a later version of this tool. The current approach has the profiler listening for Entity Framework Models that wish to send it messages. How? A bit ASPECT Oriented code weaving and WCF messaging. I have already begun to layout the UI to get a feel for it.  Currently I can’t see it supporting ESQL, however whilst that is limiting (something the Profiler API could change for me), I haven’t yet need to use it in battle and will have to revert to the old methods when I do.

I am happy to take feature requests but I cant promise that I will implement them all. I do want to keep the first and early versions very lite. Very very lite. I Should have a first look posted in a few more days for everyone to have a look at.

Share/Save/Bookmark

Creative Commons Attribution-ShareAlike 2.5 Australia
Creative Commons Attribution-ShareAlike 2.5 Australia