Entityfreamework核心2在第一次查询中变慢 [英] Entityfreamework core 2 slow in first query

查看:126
本文介绍了Entityfreamework核心2在第一次查询中变慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用(wpf,EF Core)的桌面应用程序,我注意到应用程序第一次运行时第一次查询响应有点慢,然后每件事都好了

什么是造成这个问题的原因?我该怎么办呢?



我的尝试:



i无法解决它,问题仍然是

I'm working on an desktop app using (wpf , EF Core) and i note that response little bit slow in first query when application run first time , then every thing ok
what is the cause of this problem? and how can i handel it ?

What I have tried:

i can't solve it , the problem still

推荐答案

这就是EF的预热时间。它正在与数据库建立第一个连接,并验证结构是否符合预期,以便与您的上下文一起工作。



你无能为力修复那个。
That is the "warm up time" for EF. It's doing a first connection to the database and verifying that the structure matches what it expects in order to work with your context.

There is nothing you can do to "fix" that.


你运行一个调度程序,每天早上都会触发当天的第一个查询,而其他人都在睡觉。
You run a scheduler that every morning fires off the "first query of the day" while everyone else is sleeping.


这篇关于Entityfreamework核心2在第一次查询中变慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆