难道SearchResultCollection的GetDirectoryEntry不得不再次查询ActiveDirectory的? [的DirectoryServices / .NET] [英] Does SearchResultCollection's GetDirectoryEntry have to query ActiveDirectory again? [DirectoryServices/.net]

查看:569
本文介绍了难道SearchResultCollection的GetDirectoryEntry不得不再次查询ActiveDirectory的? [的DirectoryServices / .NET]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用DirectorySearcher从的的FindAll()的.NET方法,并在SearchResultCollection的GetDirectoryEntry()方法需要另一次旅行到Active Directory?例如......

 昏暗的SRC作为SearchResultCollection
昏暗的DS作为新DirectorySearcher从
code设置DirectorySearcher从


去到Active Directory,并填写采集与结果
SRC = ds.FindAll()

......后来在code或什么
没有了code中的下一行需要再次访问的Active Directory?
昏暗德作为的DirectoryEntry = src.item(0).GetDirectoryEntry()
 

解决方案

据它将重新查询AD以获取目录条目。文档

<一个href="http://msdn.microsoft.com/en-us/library/system.directoryservices.searchresult.getdirectoryentry.aspx"相对=nofollow>参考

  

使用GetDirectoryEntry当你想   看现场条目,而不是   通过返回的条目   DirectorySearcher从,或当你想   调用,这是该对象的方法   回来了。

     

请注意:   调用GetDirectoryEntry每个SearchResult中通过DirectorySearcher从恢复可能会很慢。

When using the FindAll() method of the DirectorySearcher in .net, does the GetDirectoryEntry() method of the SearchResultCollection require another trip to Active Directory? e.g....

Dim src As SearchResultCollection
Dim ds As New DirectorySearcher
' code to setup DirectorySearcher


' go to Active Directory and fill collection with results
src = ds.FindAll()

'...later on in code or whatever
' does the next line of code require another trip to Active Directory?
Dim de As DirectoryEntry = src.item(0).GetDirectoryEntry()

解决方案

According to the documentation it will requery AD to get the directory entry.

Reference

Use GetDirectoryEntry when you want to look at the live entry instead of the entry that was returned through DirectorySearcher, or when you want to invoke a method on the object that was returned.

Note: Calling GetDirectoryEntry on each SearchResult returned through DirectorySearcher can be slow.

这篇关于难道SearchResultCollection的GetDirectoryEntry不得不再次查询ActiveDirectory的? [的DirectoryServices / .NET]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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