EF Precompiled Views and User Query

I am trying to increase the "first call" execution time for my EF requests and have found the ability to use precompiled views for requests. After I generated the pre-compiled views using the T4 template from the VS gallery, called the "EF Pre-Generator Code Generator for C #", I did not notice a performance improvement for some of my heavy queries (using "Turn On and Join").

Then I tried to examine the generated code with the t4 pattern. I saw there a class descending from DbMappingViewCachewhich returns the one requested DbMappingViewthrough its method GetView(EntitySetBase extent).

It seems that all of these views are for simple queries only, so I ask myself if there is a way to cache the view for my specific heavy request at the pre-compilation stage. Does anyone have an idea how to achieve this? Is it possible at all?

+4
source share
1 answer

Take a look at this blog post , which talks about several ways to reduce startup time.

For reference:

  • Using cached db model repository

    , , , . Code First . o-c XML . EF , .

  • :

    , Entity Framework 6, .

  • , n-gen,

    Entity Framework .NET Framework. , EF NGEN'd, , EF- JITTED , . EF - ( EntityFramework 5 ), , JITTING .

    NGEN EF , :

    %WINDIR%\Microsoft.NET\Framework\v4.0.30319\ngen install EntityFramework.dll
    

EF, , . , . web.config , /startup .

<applicationInitialization
     doAppInitAfterRestart="true" >
   <add initializationPage="/startup" />
</applicationInitialization>

(/startup) ( ) , EF .

. , .

+3

Source: https://habr.com/ru/post/1534811/


All Articles