AggregateCacheDependency 构造函数

定义

初始化 AggregateCacheDependency 类的新实例。

public:
 AggregateCacheDependency();
public AggregateCacheDependency ();
Public Sub New ()

示例

下面的代码示例使用不带参数的构造函数创建类的 AggregateCacheDependency 实例。 将创建两 CacheDependencyCacheDependency 对象,然后添加到数组 myDepArray中。 此构造函数与Add方法结合使用,使项存储在依赖这两个CacheDependency对象中Cache

         ' 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 无参数构造函数。

适用于