AggregateCacheDependency.Add(CacheDependency[]) 메서드

정의

개체의 배열 CacheDependency 을 개체에 AggregateCacheDependency 추가합니다.

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

매개 변수

dependencies
CacheDependency[]

추가할 개체의 CacheDependency 배열입니다.

예외

dependenciesnull입니다.

-또는-

개체는 CacheDependency . dependencies 입니다 null.

CacheDependency 개체가 둘 Cache 이상의 항목에서 참조됩니다.

예제

다음 코드 예제에서는 생성자와 함께 Add 메서드를 사용하여 AggregateCacheDependency 두 개의 CacheDependency 개체를 만들고, 명명된 CacheDependency배열에 myDepArray 추가한 다음, 캐시의 항목을 해당 두 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)

적용 대상