HierarchicalDataSourceView クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HierarchicalDataSourceView クラスの意味・解説 

HierarchicalDataSourceView クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

ノードまたはノードコレクションデータ ビューを、HierarchicalDataSourceControl コントロール階層データ構造表します

名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public MustInherit Class
 HierarchicalDataSourceView
Dim instance As HierarchicalDataSourceView
public abstract class HierarchicalDataSourceView
public ref class HierarchicalDataSourceView
 abstract
public abstract class HierarchicalDataSourceView
public abstract class HierarchicalDataSourceView
解説解説

ASP.NET では、Web サーバー コントロールデータバインドして、一貫した方式提供できるようにするデータ バインディング アーキテクチャサポートされています。データバインドされる Web サーバー コントロールデータ バインド コントロールいいますまた、そのバインディング容易にするクラスデータ ソース コントロールいいますデータ ソース コントロールは、ファイルストリームリレーショナル データベースビジネス オブジェクトなど、あらゆるデータ ソースを表すことができますデータ ソース コントロールにより、基になるデータソース形式かかわらず一貫した方式データデータ バインド コントロール提供されます。

階層データを表すデータ ソース コントロールは、HierarchicalDataSourceControl 抽象クラスから派生してます。データ ソース コントロールは、データ ソース コントロール オブジェクトと、それに関連付けられた、基になるデータビュー組み合わせたものと考えることができますビューは、データ ソース ビュー オブジェクトによって表されます。階層構造データ ソース コントロールでは、それらのコントロールによって表されるデータ各階レベルに対して階層構造データ ソース ビューサポートされます。データ ソース ビューは、DataSourceControl コントロール関連付けられている DataSourceView オブジェクトのような名前が付けられていませんが、一意階層パスによって識別できます

データ ソース ビューでは、データ ソース コントロール機能定義されます。HierarchicalDataSourceView を含むすべてのデータ ソース ビュー オブジェクトでは、基になるデータ ソースからのデータ取得サポートされます。データ取得は、データ階層リストを IHierarchicalEnumerable オブジェクトとして取得する Select メソッド使用して行われますすべてのデータ ソース ビュー オブジェクトには、InsertUpdateDelete並べ替えなどの操作を含む、一連の基本的な機能オプションとして用意されています。データ バインド コントロールにより、データ ソース コントロール機能検出できます。この操作は、データ ソース コントロール関連付けられたデータ ソース ビューを GetHierarchicalView メソッド使用して取得しデザイン時または実行時にそのビュークエリすることによって実行できますHierarchicalDataSourceView では、現在 InsertUpdate または Delete操作サポートされていません。

継承時の注意 HierarchicalDataSourceView から継承する場合は、Selectメンバオーバーライドする必要があります

使用例使用例

次のコード例では、HierarchicalDataSourceView クラスからクラス派生して階層構造データ ストレージ (この場合ファイル システム) からデータ取得する方法示しますFileSystemDataSourceView クラスは、厳密に指定されHierarchicalDataSourceView インスタンスです。このインスタンス使用すると、TreeView コントロールなどの階層構造Web サーバー コントロールFileSystemDataSource コントロールバインドしてファイル システム情報表示できるようになりますセキュリティ上の理由で、ファイル システム情報表示されるのは、データ ソース コントロールが、ローカルホスト上で認証された状態で使用されており、そのデータ ソース コントロール使用する Web フォーム ページ存在する仮想ディレクトリでのみ起動する場合限られます。それ以外場合は、コンストラクタ渡されviewPath パラメータ使用され現在のファイル システム パス基づいてビュー作成されます。このコード例は、HierarchicalDataSourceControl クラストピック取り上げているコード例一部分です。

' The FileSystemDataSourceView class encapsulates the
' capabilities of the FileSystemDataSource data source control.

Public Class FileSystemDataSourceView
   Inherits HierarchicalDataSourceView

   Private _viewPath As String

   Public Sub New(viewPath
 As String)
       ' This implementation of HierarchicalDataSourceView does not
       ' use the viewPath parameter but other implementations
       ' could make use of it for retrieving values.
       _viewPath = viewPath
   End Sub 'New


   ' Starting with the rootNode, recursively build a list of
   ' FileSystemInfo nodes, create FileSystemHierarchyData
   ' objects, add them all to the FileSystemHierarchicalEnumerable,
   ' and return the list.
   Public Overrides Function
 [Select]() As IHierarchicalEnumerable
      Dim currentRequest As HttpRequest = HttpContext.Current.Request

      ' SECURITY: There are many security issues that can be raised
      ' SECURITY: by exposing the file system structure of a Web server
      ' SECURITY: to an anonymous user in a limited trust scenario such
 as
      ' SECURITY: a Web page served on an intranet or the Internet.
      ' SECURITY: For this reason, the FileSystemDataSource only
      ' SECURITY: shows data when the HttpRequest is received
      ' SECURITY: from a local Web server. In addition, the data source
      ' SECURITY: does not display data to anonymous users.
      If currentRequest.IsAuthenticated AndAlso(currentRequest.UserHostAddress
 = "127.0.0.1" OrElse currentRequest.UserHostAddress
 = "::1") Then

         ' The ApplicationPath returns a physical path in VB, so do
 not MapPath.
         Dim rootPath As String
 = currentRequest.MapPath(currentRequest.ApplicationPath)

         Dim rootDirectory As New
 DirectoryInfo(rootPath)

         Dim fshe As New
 FileSystemHierarchicalEnumerable()

         Dim fsi As FileSystemInfo
         For Each fsi In
  rootDirectory.GetFileSystemInfos()
            fshe.Add(New FileSystemHierarchyData(fsi))
         Next fsi
         Return fshe
      Else
         Throw New NotSupportedException("The
 FileSystemDataSource only " + "presents data in
 an authenticated, localhost context.")
      End If
   End Function 'Select
End Class 'FileSystemDataSourceView
// The FileSystemDataSourceView class encapsulates the
// capabilities of the FileSystemDataSource data source control.
public class FileSystemDataSourceView : HierarchicalDataSourceView
{
private string _viewPath;

    public FileSystemDataSourceView(string
 viewPath)
    {
        // This implementation of HierarchicalDataSourceView does not
        // use the viewPath parameter but other implementations
        // could make use of it for retrieving values.
        _viewPath = viewPath;
    }

    // Starting with the rootNode, recursively build a list of
    // FileSystemInfo nodes, create FileSystemHierarchyData
    // objects, add them all to the FileSystemHierarchicalEnumerable
,
    // and return the list.
    public override IHierarchicalEnumerable Select() {
        HttpRequest currentRequest = HttpContext.Current.Request;

        // SECURITY: There are many security issues that can be raised
        // SECURITY: by exposing the file system structure of a Web
 server
        // SECURITY: to an anonymous user in a limited trust scenario
 such as
        // SECURITY: a Web page served on an intranet or the Internet.
        // SECURITY: For this reason, the FileSystemDataSource only
        // SECURITY: shows data when the HttpRequest is received
        // SECURITY: from a local Web server. In addition, the data
 source
        // SECURITY: does not display data to anonymous users.
        if ( currentRequest.IsAuthenticated &&
            (currentRequest.UserHostAddress == "127.0.0.1" ||
             currentRequest.UserHostAddress == "::1"))
        {
            string rootPath = currentRequest.MapPath (currentRequest.ApplicationPath);

            DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);

            FileSystemHierarchicalEnumerable fshe = new FileSystemHierarchicalEnumerable();

            foreach (FileSystemInfo fsi in
 rootDirectory.GetFileSystemInfos()) {
                fshe.Add(new FileSystemHierarchyData(fsi));
            }
            return fshe;
        }
        else {
            throw new NotSupportedException("The FileSystemDataSource
 only " + "presents data in an authenticated, localhost
 context.");
        }
    }
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
  System.Web.UI.HierarchicalDataSourceView
     System.Web.UI.WebControls.SiteMapHierarchicalDataSourceView
     System.Web.UI.WebControls.XmlHierarchicalDataSourceView
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HierarchicalDataSourceView メンバ
System.Web.UI 名前空間
DataSourceView クラス
HierarchicalDataSourceControl クラス



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「HierarchicalDataSourceView クラス」の関連用語

HierarchicalDataSourceView クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HierarchicalDataSourceView クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS