SamSaffron / MiniProfiler

A simple but effective mini-profiler for ASP.NET MVC, ASP.NET and Ruby.
http://miniprofiler.com
1.05k stars 221 forks source link

StackExchange.Profiling.EntityFramework not working with EF5 #174

Open ido-ran opened 11 years ago

ido-ran commented 11 years ago

I've upgrade my web application project from .NET 4.0 to 4.5. One of the assemblies that was updated was EntityFramework from version 4.1 to version 5.0. I'm using NuGet EntityFramework assemblies.

I saw there is a project for EF6. Should I create another one for EF5 ?

When I run my application now I get this exception:

System.IO.FileLoadException was unhandled by user code
  HResult=-2146234304
  Message=Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Source=MiniProfiler.EntityFramework
  FileName=EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  FusionLog=""
  StackTrace:
       at StackExchange.Profiling.MiniProfilerEF.IsEF41HackRequired()
       at StackExchange.Profiling.MiniProfilerEF.Initialize(Boolean applyEFHack, Boolean supportExplicitConnectionStrings) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling.EntityFramework\MiniProfilerEF.cs:line 53
       at StackExchange.Profiling.MiniProfilerEF.Initialize(Boolean supportExplicitConnectionStrings) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling.EntityFramework\MiniProfilerEF.cs:line 25
ido-ran commented 11 years ago

It looks like calling MiniProfilerEF.InitializeEF42 solve the problem. I confirmed that I have EntityFramework.dll version 5.0.0.0 loaded.

Is that the right way to do that?