SiteMapProvider.RootProvider プロパティ
アセンブリ: System.Web (system.web.dll 内)

現在のプロバイダが属するプロバイダ階層の最上位サイト マップ プロバイダである SiteMapProvider。


SiteMapProvider クラスを実装するすべてのクラスは、サイト マップ プロバイダ階層の概念をサポートできます。プロバイダ間の階層関係は、すべてそのプロバイダ自身によって SiteMapProviderCollection コレクションのスコープ外で管理されます。機能プロバイダ階層の例については、「XmlSiteMapProvider」を参照してください。

SiteMapProvider 抽象クラスを実装するクラスに RootProvider プロパティを実装する方法を次のコード例に示します。SimpleTextSiteMapProvider は、簡単なロジックを使用して、現在のプロバイダがプロバイダ階層の一部であるかどうかを判断します。プロバイダが階層の一部だった場合、親プロバイダの RootProvider プロパティを自身のプロパティとして使用します。プロバイダが階層の一部でない場合、そのプロバイダは自身のルート プロバイダです。
このコード例は、SiteMapProvider クラスのトピックで取り上げているコード例の一部分です。
' Implement the ParentProvider property. Public Overrides Property ParentProvider() As SiteMapProvider Get Return parentSiteMapProvider End Get Set(ByVal value As SiteMapProvider) parentSiteMapProvider = Value End Set End Property ' Implement the RootProvider property. Public Overrides ReadOnly Property RootProvider() As SiteMapProvider Get ' If the current instance belongs to a provider hierarchy, it ' cannot be the RootProvider. Rely on the ParentProvider. If Not (Me.ParentProvider Is Nothing) Then Return ParentProvider.RootProvider ' If the current instance does not have a ParentProvider, it is ' not a child in a hierarchy, and can be the RootProvider. Else Return Me End If End Get End Property
// Implement the ParentProvider property. public override SiteMapProvider ParentProvider { get { return parentSiteMapProvider; } set { parentSiteMapProvider = value; } } // Implement the RootProvider property. public override SiteMapProvider RootProvider { get { // If the current instance belongs to a provider hierarchy, it // cannot be the RootProvider. Rely on the ParentProvider. if (this.ParentProvider != null) { return ParentProvider.RootProvider; } // If the current instance does not have a ParentProvider, it is // not a child in a hierarchy, and can be the RootProvider. else { return this; } } }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からSiteMapProvider.RootProvider プロパティを検索する場合は、下記のリンクをクリックしてください。

- SiteMapProvider.RootProvider プロパティのページへのリンク