XmlDataSource.EnableCaching プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > XmlDataSource.EnableCaching プロパティの意味・解説 

XmlDataSource.EnableCaching プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

XmlDataSource コントロールでデータ ャッシュが有効かどうかを示す値を取得または設定します。

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

Public Overridable Property
 EnableCaching As Boolean
Dim instance As XmlDataSource
Dim value As Boolean

value = instance.EnableCaching

instance.EnableCaching = value
public virtual bool EnableCaching { get;
 set; }
/** @property */
public boolean get_EnableCaching ()

/** @property */
public void set_EnableCaching (boolean value)
public function get EnableCaching
 () : boolean

public function set EnableCaching
 (value : boolean)

プロパティ値
データ ソース コントロールでデータ キャッシュが有効な場合は true。それ以外の場合は false。既定値は true です。

解説解説
使用例使用例

XmlDataSource コントロールを使用している場合に、キャッシュを有効にして、XML ファイルに格納されたデータを表示する方法を次のコード例に示します。EnableCaching プロパティを true に設定し、CacheDuration を、データ ソース コントロールがデータをキャッシュしておく秒数に設定することによってキャッシュが有効にされています。

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<HTML>
  <BODY>
    <form runat="server">

      <asp:xmldatasource
        id="XmlDataSource1"
        runat="server"
        datafile="books.xml"
        enablecaching="True"
        cacheduration="60"
        cacheexpirationPolicy="Sliding" />

      <!- TreeView uses hierachical data, so the
          XmlDataSource uses an XmlHierarchicalDataSourceView
          when a TreeView is bound to
 it. -->

      <asp:treeview
        id="TreeView1"
        runat="server"
        datasourceid="XmlDataSource1">
        <databindings>
          <asp:treenodebinding datamember="book"
 textfield="title"/>
        </databindings>
      </asp:treeview>

    </form>
  </BODY>
</HTML>
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<HTML>
  <BODY>

    <form runat="server">
      <asp:xmldatasource
        id="XmlDataSource1"
        runat="server"
        datafile="books.xml"
        enablecaching="True"
        cacheduration="60"
        cacheexpirationpolicy="Sliding" />

      <!- TreeView uses hierachical data, so the
          XmlDataSource uses an XmlHierarchicalDataSourceView
          when a TreeView is bound to it. -->

      <asp:treeview
        id="TreeView1"
        runat="server"
        datasourceid="XmlDataSource1">
        <databindings>
          <asp:treenodebinding datamember="book" textfield="title"/>
        </databindings>
      </asp:treeview>

    </form>
  </BODY>
</HTML>
<%@ Page Language="VJ#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<HTML>
  <BODY>

    <form runat="server">
      <asp:xmldatasource
        id="XmlDataSource1"
        runat="server"
        datafile="books.xml"
        enablecaching="True"
        cacheduration="60"
        cacheexpirationpolicy="Sliding" />

      <!- TreeView uses hierachical data, so the
          XmlDataSource uses an XmlHierarchicalDataSourceView
          when a TreeView is bound to it. -->

      <asp:treeview
        id="TreeView1"
        runat="server"
        datasourceid="XmlDataSource1">
        <databindings>
          <asp:treenodebinding datamember="book" textfield="title"/>
        </databindings>
      </asp:treeview>

    </form>
  </BODY>
</HTML>

コード例の XML ファイルには、次のデータが含まれています。

<books>
   <computerbooks>
     <book title="Secrets of Silicon Valley" author="Sheryl Hunter"/>
     <book title="Straight Talk About Computers" author="Dean Straight"/>
     <book title="You Can Combat Computer Stress!" author="Marjorie Green"/>
                
   </computerbooks>
   <cookbooks>
     <book title="Silicon Valley Gastronomic Treats" author="Innes del Castill"/>
   </cookbooks>
</books>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
XmlDataSource クラス
XmlDataSource メンバ
System.Web.UI.WebControls 名前空間
XmlDataSource.CacheDuration プロパティ
XmlDataSource.CacheExpirationPolicy プロパティ



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

XmlDataSource.EnableCaching プロパティのお隣キーワード
検索ランキング

   

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



XmlDataSource.EnableCaching プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS