Last week, I tried testing some of the new EF6 features in my usual sample application. Unfortunately, the application crashed because the version of MiniProfiler.EF I was referencing only works with EF4/5. As someone pointed out on Mini Profiler community forum, EF6 support was added to GitHub but is not yet available in the Nuget package.
I am too impatient to wait for a new Nuget package, so I went over to Github and cloned the MiniProfiler repo.
Upon inspecting the MiniProfiler solution, I noticed there are 2 Entity Framework related projects: StackExchange.Profiling.EntityFramework and StackExchange.Profiling.EntityFramework6.
Why is this implemented in a different project? In short, because the EF team made it WAY easier to extend Entity Framework by implementing a new Provider Model. You can read more about that here. The Mini Profiler folks used this feature to implement hooks into Entity Framework 6. You can tell how much easier this was to implement because the old assembly (StackExchange.Profiling.EntityFramework) contains 10 classes. The new StackExchange.Profiling.EntityFramework6 assembly contains only 2 classes! The classes are very small too. Just a few short methods.
After snooping around in the code, I compiled the project and added a reference in my sample application to the new MiniProfiler.EntityFramework6.dll. Finally, I added the following code in my application start logic:
DbConfiguration.Loaded += (sender, a) =>
(services, o) =>
This is a little more complicated than initializing MiniProfiler for EF4/5, but I suspect the Mini Profiler team will provide us with a simple MiniProfilerEF.Initialize() method before they ship a Nuget package. In the mean time, you can follow the steps above to get Mini Profiler EF working with EF6 RC1.
UPDATE: I received an email from Tom Powers pointing out that the above can also be accomplished by setting the EF provider in your [Web.config / App.config.
As far as I can tell, the profiler output is unchanged:
It is also worth noting that simple SQL logging essentially built in to EF6. You can read more about that here.