SiteMapProvider.GetCurrentNodeAndHintAncestorNodes(Int32) 方法

定义

在站点地图提供程序检索当前请求页的节点并获取当前页的父和祖先站点地图节点时,为其提供经优化的查找方法。Provides an optimized lookup method for site map providers when retrieving the node for the currently requested page and fetching the parent and ancestor site map nodes for the current page.

public:
 virtual System::Web::SiteMapNode ^ GetCurrentNodeAndHintAncestorNodes(int upLevel);
public virtual System.Web.SiteMapNode GetCurrentNodeAndHintAncestorNodes (int upLevel);
abstract member GetCurrentNodeAndHintAncestorNodes : int -> System.Web.SiteMapNode
override this.GetCurrentNodeAndHintAncestorNodes : int -> System.Web.SiteMapNode
Public Overridable Function GetCurrentNodeAndHintAncestorNodes (upLevel As Integer) As SiteMapNode

参数

upLevel
Int32

要获取的祖先站点地图节点的代数。The number of ancestor site map node generations to get. 值为 -1 指示提供程序可检索和缓存所有祖先节点。A value of -1 indicates that all ancestors might be retrieved and cached by the provider.

返回

SiteMapNode

表示当前请求页的 SiteMapNode;否则,如果没有找到或不能为当前用户返回 SiteMapNode,则为 nullA SiteMapNode that represents the currently requested page; otherwise, null, if the SiteMapNode is not found or cannot be returned for the current user.

例外

upLevel 小于 -1。upLevel is less than -1.

注解

方法的默认实现 GetCurrentNodeAndHintAncestorNodes 返回 CurrentNode 属性; 但是,站点地图提供程序可以重写 GetCurrentNodeAndHintAncestorNodes 方法,并提供一个使用自定义缓存机制来返回当前的优化实现,以及 SiteMapNode 父节点的父节点和祖先节点。The default implementation of the GetCurrentNodeAndHintAncestorNodes method returns the CurrentNode property; however, site map providers can override the GetCurrentNodeAndHintAncestorNodes method and provide an optimized implementation that uses custom caching mechanisms to return the current SiteMapNode, as well as the parent and ancestor nodes of the parent.

upLevel参数用于指定要检索的父节点和祖先节点的级别数。The upLevel parameter is used to specify how many levels of parent and ancestor nodes to retrieve. 如果需要,可以使用属性将父节点和祖先节点链接到该 SiteMapNode 方法返回的对象 GetCurrentNodeAndHintAncestorNodes ParentNodeIf preferred, the parent and ancestor nodes can be linked to the SiteMapNode object that is returned by the GetCurrentNodeAndHintAncestorNodes method, using the ParentNode property.

XmlSiteMapProvider类是 ASP.NET 的默认站点地图提供程序,它将整个站点地图缓存到内存中,这会导致在查询特定对象的时不会产生很大的开销 XmlSiteMapProvider SiteMapNodeThe XmlSiteMapProvider class, which is the default site map provider for ASP.NET, caches the entire site map in memory, which results in little or no overhead when querying the XmlSiteMapProvider for specific SiteMapNode objects.

适用于

另请参阅