I want to reduce startup time in EF6 by caching the DbCompiledModel to disk.
It's easy to write the EDMX file for a DbContext:
EdmxWriter.WriteEdmx(myDbContext, XmlWriter.Create(@"C:\temp\blah.xml"))
And it's easy to pass a DbCompiledModel to the DbContext:
var db = new DbContext(connectionString, myDbCompiledModel)
However there doesn't seem to be any way to read the EDMX file from disk into a DbCompiledModel! How can I do this?
NOTE that I have successfully implemented the solution using the EdmxReader tool in this branched version of EF6:
https://github.com/davidroth/entityframework/tree/DbModelStore
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.
So, how can I get the EDMX file from disk and convert it into a DbCompiledModel?