I want to reduce startup time in EF6 by caching DbCompiledModel to disk.
Easy to write EDMX file for DbContext:
EdmxWriter.WriteEdmx(myDbContext, XmlWriter.Create(@"C:\temp\blah.xml"))
And it's easy to pass the DbCompiledModel to the DbContext:
var db = new DbContext(connectionString, myDbCompiledModel)
However, there seems to be no way to read the EDMX file from disk in DbCompiledModel! How can i do this?
NOTE that I successfully implemented the solution using the EdmxReader tool in this forked version of EF6:
https://github.com/davidroth/entityframework/tree/DbModelStore
However, I do not want to use the version of the branch in the production environment. I tried to extract the EdmxReader utility from this branch, but it relies on the internal DbCompiledModel constructor, which I cannot access.
So, how can I get the EDMX file from disk and convert it to DbCompiledModel?
Brendan hill
source share