SiteMapProvider.GetParentNodeRelativeToNodeAndHintDownFromParent(SiteMapNode, Int32, Int32) 方法

定义

在站点地图提供程序检索指定 SiteMapNode 对象的祖先节点并获取其子节点时,为其提供经优化的查找方法。Provides an optimized lookup method for site map providers when retrieving an ancestor node for the specified SiteMapNode object and fetching its child nodes.

public:
 virtual System::Web::SiteMapNode ^ GetParentNodeRelativeToNodeAndHintDownFromParent(System::Web::SiteMapNode ^ node, int walkupLevels, int relativeDepthFromWalkup);
public virtual System.Web.SiteMapNode GetParentNodeRelativeToNodeAndHintDownFromParent (System.Web.SiteMapNode node, int walkupLevels, int relativeDepthFromWalkup);
abstract member GetParentNodeRelativeToNodeAndHintDownFromParent : System.Web.SiteMapNode * int * int -> System.Web.SiteMapNode
override this.GetParentNodeRelativeToNodeAndHintDownFromParent : System.Web.SiteMapNode * int * int -> System.Web.SiteMapNode
Public Overridable Function GetParentNodeRelativeToNodeAndHintDownFromParent (node As SiteMapNode, walkupLevels As Integer, relativeDepthFromWalkup As Integer) As SiteMapNode

参数

node
SiteMapNode

SiteMapNode,用作 walkupLevelsrelativeDepthFromWalkup 的参考点。The SiteMapNode that acts as a reference point for walkupLevels and relativeDepthFromWalkup.

walkupLevels
Int32

在检索请求的祖先节点时要遍历的祖先节点的层次数。The number of ancestor node levels to traverse when retrieving the requested ancestor node.

relativeDepthFromWalkup
Int32

要从目标祖先节点检索的子代节点的层次数。The number of descendant node levels to retrieve from the target ancestor node.

返回

SiteMapNode

表示 node 的祖先的 SiteMapNode;如果未找到或者无法为当前用户返回当前或祖先 SiteMapNode,则为 nullA SiteMapNode that represents an ancestor of node; otherwise, null, if the current or ancestor SiteMapNode is not found or cannot be returned for the current user.

例外

walkupLevelsrelativeDepthFromWalkup 指定的值小于 0。The value specified for walkupLevels or relativeDepthFromWalkup is less than 0.

nodenullnode is null.

注解

类的默认实现 SiteMapProvider 提供方法的非优化实现 GetParentNodeRelativeToNodeAndHintDownFromParent ,调用 HintAncestorNodesHintNeighborhoodNodes 方法; 但是,站点地图提供程序可以重写 GetParentNodeRelativeToNodeAndHintDownFromParent 方法并提供经过优化的实现,该实现使用自定义缓存机制来返回祖先节点并对其他对象执行优化查找 SiteMapNodeThe default implementation of the SiteMapProvider class provides a non-optimized implementation of the GetParentNodeRelativeToNodeAndHintDownFromParent method, calling the HintAncestorNodes and HintNeighborhoodNodes methods; however, site map providers can override the GetParentNodeRelativeToNodeAndHintDownFromParent method and provide an optimized implementation that uses custom caching mechanisms to return the ancestor node and perform an optimized lookup of the other SiteMapNode objects. GetParentNodeRelativeToNodeAndHintDownFromParent方法非常类似于 GetParentNodeRelativeToCurrentNodeAndHintDownFromParent 方法。The GetParentNodeRelativeToNodeAndHintDownFromParent method is very similar to the GetParentNodeRelativeToCurrentNodeAndHintDownFromParent method.

walkupLevels参数用于指定在检索目标节点时要遍历多少级别的父节点和祖先节点。The walkupLevels parameter is used to specify how many levels of parent and ancestor nodes to traverse when retrieving the target node. 如果存在比请求的级别更少的级别, null 则返回。If fewer levels exist than are requested, null is returned. downLevel参数用于指定要检索的目标祖先节点中有多少级别的子代节点。The downLevel parameter is used to specify how many levels of descendant nodes from the target ancestor node to retrieve. 如果需要,可以 SiteMapNode GetParentNodeRelativeToNodeAndHintDownFromParent 使用 ParentNode 和属性将祖先节点和子代节点链接到该方法返回的 ChildNodesIf preferred, the ancestor and descendant nodes can be linked to the SiteMapNode that is returned by the GetParentNodeRelativeToNodeAndHintDownFromParent method, using the ParentNode and ChildNodes properties. 如果祖先节点级别少于参数指定的级别 upLevelnull 则返回。If there are fewer ancestor node levels than specified by the upLevel parameter, null is returned. 由提供商的实施者决定如何处理可用子代节点级别数小于参数指定的值的情况如何处理 downLevelIt is up to the provider implementer to decide how to handle the situation where the number of available descendant node levels is less than the value that is specified by the downLevel parameter.

适用于

另请参阅