locked
EF Core, first query is slow, how to generate a precompile view to improve performance RRS feed

  • Question

  • User956626884 posted

    Hi,

    I am working on webapi 3.1 with entityframework core 3.16. I got about 180 entity that is slow with the first query. I read that precompiled entityframework view can help improve performance. I watched a video, https://www.youtube.com/watch?v=qsm12syxRWs

    After watching it, I downloaded EF Core Power Tools and EntityFramework Power Tools in the Extension menu. When I right clicked on my MyModelDbContext.cs, I don't see the "Optimize Entity Model" option. I just see Generate Views which did not generate any file. When I right clicked on the Repository C# Library project, I see EF Core Tools but it has no options about Optimizing the data model. 

    How can this be done? Thanks,

    Thursday, May 6, 2021 6:13 PM

Answers

  • User1120430333 posted

    I don't think EF Core has any tools that have the ability to generate precompiled  views like EF6 and lower versions of EF can do. 180 objects on the model is a lot. Like no application I bet that you have needs the 180 object model, and they only need a segment of model objects dedicated to that particular application solution usage. If it were me, I would not have a 180 virtual object model. 

    You want the user to stop complaining about how slow a given application is on first time usage when an EF coldstart has happened then I say you ping the model with a query to keep EF in a warmstart state.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 7, 2021 8:09 AM