Spent better part of the day combing through SO for this. Here's the setup
This is how I create my Db Context in the repository
public class TransactionRepository : BaseRepository, ITransactionRepository
{
AccountingEntities _db = new AccountingEntities();
// repository methods
}
Then in controllers
public class InvoiceController : BaseController
{
private ITransactionRepository _txnRepository;
public InvoiceController()
{
_txnRepository = new TransactionRepository();
}
public InvoiceController(ITransactionRepository t)
{
_txnRepository = t;
}
}
Finally, I've added to web.config
<system.data>
<DbProviderFactories>
<remove invariant="MvcMiniProfiler.Data.ProfiledDbProvider" />
<add name="MvcMiniProfiler.Data.ProfiledDbProvider" invariant="MvcMiniProfiler.Data.ProfiledDbProvider" description="MvcMiniProfiler.Data.ProfiledDbProvider" type="MvcMiniProfiler.Data.ProfiledDbProviderFactory, MvcMiniProfiler, Version=1.8.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3" />
</DbProviderFactories>
</system.data>
What are the next steps to profile these connections? Walk me slowly as this is my first exposure to Entity Framework, so assume very little about EF connection/context details.
I rewrote the interception code so it is way more robust.
MiniProfilerEF.Initialize();