在实体框架中设置提取大小 [英] Setting fetch size in entity framework
问题描述
我正在将ado.net代码转换为使用EF.在我的ado.net代码中,我设置了dataReader.FetchSize = command.RowSize * 1000
,与默认的获取大小相比,它大大提高了性能.
当我将代码转换为EF时,性能与ado.net代码相当,在该代码中我未指定获取大小,即在处理大记录时非常慢.
I am converting ado.net code to use EF. In my ado.net code i set dataReader.FetchSize = command.RowSize * 1000
and that dramatically improves performance over the default fetch size .
When I convert my code to EF, the performance is on par to ado.net code where I didn't specify fetch size, i.e. it's very slow over large records.
我可以指定获取大小以在EF中检索记录吗?
Any way I could specify fetch size for retrieving records in EF?
推荐答案
使用实体框架时,可以在注册表或.NET配置文件中设置ODP.NET FetchSize.这将使所有ODP.NET实例(对于注册表)或应用程序(对于app/web.config)的FetchSize标准化.
You can set ODP.NET FetchSize in the Registry or the .NET config files when using Entity Framework. That will standardize the FetchSize across all your ODP.NET instances (in the case of the Registry) or across your application (in the case of app/web.config).
http://docs.oracle.com/cd/E48297_01/doc/win.121/e41125/featConfig.htm
克里斯蒂安·谢伊
Oracle
这篇关于在实体框架中设置提取大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!