SiteMapProvider.HintAncestorNodes(SiteMapNode, Int32) 方法

定義

提供方法,讓網站導覽提供者可以覆寫,以最佳化方式擷取相對於指定 SiteMapNode 物件的一或多個層級之父代和祖系節點。Provides a method that site map providers can override to perform an optimized retrieval of one or more levels of parent and ancestor nodes, relative to the specified SiteMapNode object.

public:
 virtual void HintAncestorNodes(System::Web::SiteMapNode ^ node, int upLevel);
public virtual void HintAncestorNodes (System.Web.SiteMapNode node, int upLevel);
abstract member HintAncestorNodes : System.Web.SiteMapNode * int -> unit
override this.HintAncestorNodes : System.Web.SiteMapNode * int -> unit
Public Overridable Sub HintAncestorNodes (node As SiteMapNode, upLevel As Integer)

參數

node
SiteMapNode

SiteMapNode,做為 upLevel 的參考點。The SiteMapNode that acts as a reference point for upLevel.

upLevel
Int32

要擷取的祖系 SiteMapNode 層代數。The number of ancestor SiteMapNode generations to fetch. 0 表示不擷取任何祖系節點,而 -1 則表示可以擷取和快取所有祖系。0 indicates no ancestor nodes are retrieved and -1 indicates that all ancestors might be retrieved and cached.

例外狀況

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

nodenullnode is null.

備註

預設 HintAncestorNodes 方法只 upLevel 會檢查小於-1 的參數和 node 參數 nullThe default HintAncestorNodes method only checks for an upLevel parameter that is less than -1 and a node parameter that is null. 因為 XmlSiteMapProvider 類別會將網站地圖資訊快取到記憶體中,所以 HintAncestorNodes 不會使用方法。Because the XmlSiteMapProvider class caches site map information in memory, the HintAncestorNodes method is not used.

網站地圖提供者可以覆寫 HintAncestorNodes 方法,以對指定物件的父系和上階節點執行優化的抓取 SiteMapNodeSite map providers can override the HintAncestorNodes method to perform an optimized retrieval of parent and ancestor nodes of the specified SiteMapNode object.

upLevel參數是用來指定要從指定的中進行的父節點和祖系節點的層級數目 SiteMapNodeThe upLevel parameter is used to specify how many levels of parent and ancestor nodes to traverse from the specified SiteMapNode. 如果有比所要求更少的層級,則會在指定的系結內傳回所有可用的上階節點。If fewer levels exist than are requested, all available ancestor nodes are returned within the specified bound. 如果偏好的話,可以使用屬性,將父節點連結到指定的 SiteMapNode ParentNodeIf preferred, the parent node can be linked to the specified SiteMapNode using the ParentNode property.

適用於

另請參閱