Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get MVC-mini-profiler working on EF 4.1 Database First
    text
    copied!<p>Spent better part of the day combing through SO for this. Here's the setup</p> <ul> <li>MVC 3 App using Repository pattern with 3 repositories across 2 databases.</li> <li>EF 4.1 Database first using the <a href="http://msdn.microsoft.com/en-us/data/gg192989" rel="nofollow">DBContext API</a> for both db connections.</li> <li>Installed mvc-mini-profiler from nuget</li> </ul> <p>This is how I create my Db Context in the repository</p> <pre><code>public class TransactionRepository : BaseRepository, ITransactionRepository { AccountingEntities _db = new AccountingEntities(); // repository methods } </code></pre> <p>Then in controllers</p> <pre><code>public class InvoiceController : BaseController { private ITransactionRepository _txnRepository; public InvoiceController() { _txnRepository = new TransactionRepository(); } public InvoiceController(ITransactionRepository t) { _txnRepository = t; } } </code></pre> <p>Finally, I've added to web.config</p> <pre><code> &lt;system.data&gt; &lt;DbProviderFactories&gt; &lt;remove invariant="MvcMiniProfiler.Data.ProfiledDbProvider" /&gt; &lt;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" /&gt; &lt;/DbProviderFactories&gt; &lt;/system.data&gt; </code></pre> <p>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.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload