Entity Framework initialization is SLOW — what can I do to bootstrap it faster?

In pre EF6 view generation is known to be slow for bigger models. For now the solution is to use pregenerated views. This way you generate views at design time and are avoiding this work at runtime. To do that download EF power tools and select “Optimize Entity Data Model”. It will add a C# file to your project that contains views. The down side is that you will need to do it each time your model changes. Note: to generate views with the tool it will take about the same amount of time it takes to generate views at runtime (so sometimes you need to be patient). Here is a post about EF Power Tools that might be helpful: http://blogs.msdn.com/b/adonet/archive/2011/05/18/ef-power-tools-ctp1-released.aspx


Recently I created a different solution that is much more convenient to use (note it only works on EF6) – http://blog.3d-logic.com/2013/12/14/using-pre-generated-views-without-having-to-pre-generate-views-ef6/

Leave a Comment