title: Entity framework very slow to load for first time after every compilation
body: <p>As the title suggest i'm having a problem with the first query against a SQL Server database using the Entity Framework. I have tried looking for an answer but no one seems to actually have a solution to this.</p>
  
  <p>The tests was done in Visual Studio 2012 using Entity Framework 6, I also used the T4 views template to pre-compile the views. The database was on a SQL Server 2008. We have about 400 POCOs (400 mapping files), only have 100 rows data in database table.</p>
  
  <p>Following capture is my test code and  result.</p>
  
  <pre><code>static void Main(string[] args){
      Stopwatch st=new Stopwatch();
      st.Start();
      new TestDbContext().Set&lt;Table1&gt;.FirstOrDefault();
      st.stop();
      Console.WriteLine("First Time "+st.ElapsedMilliseconds+ " milliseconds");
  
      st.Reset();
      st.Start();
      new TestDbContext().Set&lt;Table1&gt;.FirstOrDefault();
      st.stop();
      Console.WriteLine("Second Time "+st.ElapsedMilliseconds+ " milliseconds");
  }
  </code></pre>
  
  <p>Test results</p>
  
  <pre><code>First Time 15480 milliseconds
  Second Time 10 milliseconds
  </code></pre>