AggregateCacheDependency.GetUniqueID 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
检索对象的唯一标识符 AggregateCacheDependency 。
public:
override System::String ^ GetUniqueID();
public override string GetUniqueID();
override this.GetUniqueID : unit -> string
Public Overrides Function GetUniqueID () As String
返回
对象的唯一标识符 AggregateCacheDependency 。 如果其中一个关联的依赖项对象没有唯一标识符,该方法 GetUniqueID() 将 null返回。
示例
下面的代码示例使用 GetUniqueID 该方法创建和显示类实例的 AggregateCacheDependency 标识符,命名 aggDep后,创建并填充该实例。
' 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)
注解
此方法为数组中的每个依赖项分配唯一标识符,并返回每个依赖项。 标识符是文件名(对于文件依赖项)或密钥名称(对于缓存键依赖项)和此方法分配给依赖项的字符串的组合。