Cast error using EF5 and MVC4


#1

I’m using EF5 and MVC4. And Code First.

I’ve the following connection string:

<connectionStrings>
  <add name="MyDataContext" connectionString="Data Source=|DataDirectory|DemoData.sdf" providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>

When I use MiniProfilerEF.Initialize(false) in Global.asax.cs, I get an error when executing a query.Count()

Unable to cast object of type 'StackExchange.Profiling.Data.EFProfiledDbConnection' to type 'System.Data.SqlServerCe.SqlCeConnection'.