Search code examples
entity-frameworkvisual-studio-2013ef-power-tools

Visual Studio Ultimate 2013 crashes when using Entity Framework Power Tools Beta 4


I'm running VS Ultimate 2013 on a Windows 8.1 machine and have been successfully for several months now. However, I just installed the NuGet package for Entity Framework Power Tools Beta 4 today and am having issues. After installing EFPT, I restarted VS, loaded my solution, made my "data" project the startup project, right-clicked on my class deriving from DbContext -> Entity Framework -> Generate Views. Visual Studio completely crashes and restarts. I've tried clicking on other options in in the EFPT context menu such as "View Entity Data Model (read-only)" and all of them results in VS completely crashing and restarting.

I was running VS with Update 3, so I installed Update 4 and still the same issue. It does NOT crash if running devenv.exe in safemode, but EFPT doesn't actually DO anything either.

So now, I'm running VS version 12.0.31101.00 Update 4 with .NET Fx 4.5.51641 and Entity Framework 6.1.2.

Ultimately, I'm trying to create a EDM mapping file for my code-first EF context to cache and reduce startup time. If this issue I'm having is a known issue, is there a fix OR a workaround in generating this mapping???


Solution

  • Thank you Erik. I wanted to answer my own question because I was able to take it a step further. Rather than writing (a LOT) of code to generate cached views and having to run it every time your code changes.

    A dev on the SignalR team at Microsoft, Pawel Kadluczka, wrote a nice and EASY-TO-USE bit of code that can be installed via NuGet. The "Interactive Pre-Generated Views" project, when added to your data assembly, will look for cached views and if not found, generate them on the fly. Out of the box, it supports both file and db cached view info.

    The only bit of code I had to add to utilize this was:

    static DynamicDbContext()
        {
            InteractiveViews.SetViewCacheFactory(new DynamicDbContext(), new FileViewCacheFactory(_SCRIPT_DIRECTORY + "dbviews.xml"));
        }
    

    It literally took me 5 minutes to install, write the bit of code, execute and confirm.

    It needs to run prior to any query being executed with your dbcontext and so he recommends this bit of code to be placed in a static ctor of your custom dbContext.

    Pawel's blog post where he describes it is: http://blog.3d-logic.com/2013/12/14/using-pre-generated-views-without-having-to-pre-generate-views-ef6/

    You can install via NuGet or read more about it on CodePlex: https://efinteractiveviews.codeplex.com/