AggregateCacheDependency 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 AggregateCacheDependency 类的新实例。
public:
AggregateCacheDependency();
public AggregateCacheDependency ();
Public Sub New ()
示例
下面的代码示例使用不带参数的构造函数创建类的 AggregateCacheDependency 实例。 将创建两 CacheDependency 个 CacheDependency 对象,然后添加到数组 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 无参数构造函数。