title: EF6 code first: How to load DbCompiledModel from EDMX file on startup?
body: <p>I want to reduce startup time in EF6 by caching the DbCompiledModel to disk.</p>
  
  <p>It's easy to write the EDMX file for a DbContext:</p>
  
  <pre><code>EdmxWriter.WriteEdmx(myDbContext, XmlWriter.Create(@"C:\temp\blah.xml"))
  </code></pre>
  
  <p>And it's easy to pass a DbCompiledModel to the DbContext:</p>
  
  <pre><code>var db = new DbContext(connectionString, myDbCompiledModel)
  </code></pre>
  
  <p>However there doesn't seem to be any way to read the EDMX file from disk into a DbCompiledModel! How can I do this?</p>
  
  <p>NOTE that I have successfully implemented the solution using the EdmxReader tool in this branched version of EF6:</p>
  
  <pre><code>https://github.com/davidroth/entityframework/tree/DbModelStore
  </code></pre>
  
  <p>However I am reluctant to use a branch version in a production environment. I have tried extracting the EdmxReader utility from this branch, but it relies on an internal constructor of DbCompiledModel which I can't access.</p>
  
  <p>So, how can I get the EDMX file from disk and convert it into a DbCompiledModel?</p>