第一个实体框架 6 非查询的 6 秒预热时间 [英] Six seconds warmup time for the first entity framework 6 nonquery

查看:9
本文介绍了第一个实体框架 6 非查询的 6 秒预热时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自我的集成测试:

// Act
Stopwatch w = new Stopwatch();
w.Start();
userService.Create(userDTO);
w.Stop();


public void Create(UserDTO userDTO)
{
    var user = userDTO.ToEntity();
    _context.Entry(user).State = EntityState.Added;
    _context.SaveChanges();
}

6,2 秒做一个sql insert"是疯狂的.我已经看到应用程序用户在他们第一次打开他们全年使用的项目时抱怨.所以每天他们都要等6秒……

6,2 seconds to do an "sql insert" is crazy. I already see the application users complaining when they first open a project which they use the whole year. So everyday they have to wait 6 seconds...

我认为 EF6 的预热时间有所改善?

I thought the warm up time in EF6 has improved?

我能做些什么来改善这种可悲的行为吗?

Is there anything I can do to improve this miserable behavior?

推荐答案

试试 适用于 C# 的 EF6 CodeFirst 视图生成 T4 模板.预先生成的视图通过将必须在运行时完成的工作转移到设计时来缩短应用程序的启动时间.更多信息

Try EF6 CodeFirst View Generation T4 Template for C#. Pre-generated views improve application start-up time by moving the work that would have to be done at runtime to design time. more info

这篇关于第一个实体框架 6 非查询的 6 秒预热时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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