AggregateCacheDependency 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 AggregateCacheDependency 類別的新執行個體。
public:
AggregateCacheDependency();
public AggregateCacheDependency();
Public Sub New ()
範例
以下程式碼範例使用不接受參數的建構子建立該 AggregateCacheDependency 類別的實例。 先建立兩個 CacheDependency 物件,然後加入一個 CacheDependency 陣列 myDepArray。 此建構子與使儲存在 中的Add項目依賴於兩個Cache物件的方法結合CacheDependency使用。
' Create two CacheDependency objects, one to a
' text file and the other to an XML file.
' Create a CacheDependency array with these
' two objects as items in the array.
txtDep = New CacheDependency(Server.MapPath("Storage.txt"))
xmlDep = New CacheDependency(Server.MapPath("authors.xml"))
Dim DepArray() As CacheDependency = {txtDep, xmlDep}
' Create an AggregateCacheDependency object and
' use the Add method to add the array to it.
aggDep = New AggregateCacheDependency()
aggDep.Add(DepArray)
' Call the GetUniqueId method to generate
' an ID for each dependency in the array.
msg1.Text = aggDep.GetUniqueId()
' Add the new data set to the cache with
' dependencies on both files in the array.
Cache.Insert("XMLDataSet", Source, aggDep)
備註
這是該類別的 AggregateCacheDependency 無參數建構子。