AggregateCacheDependency.Add(CacheDependency[]) Método

Definición

Agrega una matriz de CacheDependency objetos al AggregateCacheDependency objeto .

public:
 void Add(... cli::array <System::Web::Caching::CacheDependency ^> ^ dependencies);
public void Add(params System.Web.Caching.CacheDependency[] dependencies);
member this.Add : System.Web.Caching.CacheDependency[] -> unit
Public Sub Add (ParamArray dependencies As CacheDependency())

Parámetros

dependencies
CacheDependency[]

Matriz de CacheDependency objetos que se van a agregar.

Excepciones

dependencies es null.

O bien

Un CacheDependency objeto de dependencies es null.

Se hace referencia a un CacheDependency objeto desde más de una Cache entrada.

Ejemplos

En el ejemplo de código siguiente se usa el Add método junto con el AggregateCacheDependency constructor para crear dos CacheDependency objetos, agregarlos a una CacheDependency matriz denominada myDepArrayy, a continuación, hacer que el elemento de la memoria caché dependa de esos dos CacheDependency objetos.

         ' 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)

Se aplica a