为什么实体框架很慢 [英] why entity framework is slow

查看:112
本文介绍了为什么实体框架很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i使用实体框架动态添加和删除ASP.NET GridView中的行有些事情如下 -



动态添加和删除ASP.NET GridView中的行 [ ^ ]



当我添加第一行时我快速工作,在第二行它比第一行花费更多时间等等。



任何人都可以给我解决方案。

解决方案

这是3条建议: http:// www.fusonic.net/en/blog/2014/07/09/three-steps-for-fast-entityframework-6.1-first-query-performance/



A.摘要:



使用缓存的db模型商店

生成预编译的视图

生成预编译版本实体框架使用n-gen来避免抖动



我还要确保在进行基准测试时我在发布模式下编译应用程序。



另一个解决方案是看看拆分DBContext。如果你有大量的实体,那么它很多,使用较小的块应该更好。我没有尝试过,但我认为可以逐个构建模型,这意味着没有一个负载需要15秒。请参阅Julie Lerman的这篇文章 https://msdn.microsoft.com/en-us/magazine/jj883952。 ASPX

Hi guys,

i am using entity framework for "Dynamically adding and deleting rows from ASP.NET GridView" some thing like below-

Dynamically adding and deleting rows from ASP.NET GridView[^]

when i add first row i work fast, in 2nd row it's taking more time than first row and so on.

can any one please give me solution for that.

解决方案

Here is 3 suggestions: http://www.fusonic.net/en/blog/2014/07/09/three-steps-for-fast-entityframework-6.1-first-query-performance/

A summary:

Using a cached db model store
Generate pre-compiled views
Generate pre-compiled version of entityframework using n-gen to avoid jitting

I would also make sure that I compile the application in release mode when doing the benchmarks.

Another solution is to look at splitting the DBContext.If you have a large number of entities then it is a lot and it should be nicer to work with smaller chunks. I haven't tried it but I assume it would be possible to build the models one by one meaning no single load takes 15s. See this post by Julie Lerman https://msdn.microsoft.com/en-us/magazine/jj883952.aspx


这篇关于为什么实体框架很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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