最近在使用sps类库过程中发现了一个让我比较疑惑的问题(有关items属性的)

类别:.NET开发 点击:0 评论:0 推荐:

大家都知道 SPList对象有个属性 items ,在文档中是这样解释的

The Items property of the SPList class gets the collection of all items in the list. Remarks返回当前 List中的所有的item对象集合

The Items property returns all the files in a document library, including files in subfolders, but not the folders themselves. In a document library, folders are not considered items. 在一个document library(文档库)中返回其下所有的文件不包括其目录。

我们在做一个项目,使用wss做后台存储,开发环境数据库中现在有大概2G多的数据,其中主要用的是list 和 document library  站点下大概有查不多1000来个list和 document library ,测试发现性能极其差,每个操作大都需要几秒钟左右,后来反复测试才发现问题处在---- List.Items 属性返回 的时间大概都要用4秒来钟,这弱智得东西,这不是坑人嘛。后来我把这个属性换成GetItems(Microsoft.SharePoint.SPView) 方法(The GetItems method of the SPList class returns a collection of list items from the list based on the specified view. )

具体我是这样用的objList.GetItems(objList. DefaultView),再次测试结果发现返回items集合只用了0.3秒左右的时间。

我就不明白了~都是同一家公司出的如此相似的两个操作性能差距砸就那大尼。

看来以后items属性千万不能用 ,直接cut掉得拉

本文地址:http://com.8s8s.com/it/it43115.htm