title: Pre-Generate Views for EF Code First
body: <p>Having finally deployed to live a new site built with Entity Framework Code First and MySql, one nagging annoyance is the pause often experienced while view metadata is cached. This seems to happen far more frequently than the application pool is recycled. (?)</p>
  
  <p>I guess that for a site which has a constant stream of traffic this might not be noticed often. For a new site with infrequent traffic it feels like every time I go to the site there's a 4-5 second delay in rendering the first page.</p>
  
  <p>So I tracked down the following links:</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/bb896240.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb896240.aspx</a></p>
  
  <p><a href="http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d" rel="nofollow">http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d</a></p>
  
  <p>The EF Power Tools CTP1 looked promising, apart from the fact that it seems to be broken for EF 4.3 and hasn't been updated for months. Also I'm not sure how that tool would fit in to our automated build process.</p>
  
  <p>The OptimizeContext() or WriteEdmx() methods that EF Power Tools is using throw this error</p>
  
  <pre><code>System.Reflection.TargetInvocationException: 
  Exception has been thrown by the target of an invocation. ---&gt;    System.Data.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string. ---&gt; System.Data.SqlClient.SqlException: 
  A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
  </code></pre>
  
  <p>I initially assumed this might be MySql related but several others on the EF Power Tools Q&amp;A section are reporting it.</p>
  
  <p>So, in short, how do I pre-generate views for EF 4.3 code first, preferable in a way that can slot into an automated build process?</p>