Why is Entity Framework taking 30 seconds to load records when the generated query only takes 1/2 of a second?

前端 未结 4 1161
深忆病人
深忆病人 2020-12-08 16:34

The executeTime below is 30 seconds the first time, and 25 seconds the next time I execute the same set of code. When watching in SQL Profiler, I immediately see a login, t

4条回答
  •  暖寄归人
    2020-12-08 17:16

    EF takes a while to start up. It needs build metadata from xml and probably generates objects used for mapping. So it takes a few sec to start up, i don't think there is a way to get around that, except never restarting your program.

提交回复
热议问题