CacheDependency.NotifyDependencyChanged(Object, EventArgs) 메서드


파생 CacheDependency 클래스에 나타나는 종속성이 변경되었음을 기본 CacheDependency 개체에 알립니다.Notifies the base CacheDependency object that the dependency represented by a derived CacheDependency class has changed.

 void NotifyDependencyChanged(System::Object ^ sender, EventArgs ^ e);
protected void NotifyDependencyChanged (object sender, EventArgs e);
member this.NotifyDependencyChanged : obj * EventArgs -> unit
Protected Sub NotifyDependencyChanged (sender As Object, e As EventArgs)

매개 변수


이벤트 소스입니다.The source of the event.


이벤트 데이터가 포함된 EventArgs 개체입니다.An EventArgs object that contains the event data.


다음 코드 예제에서 상속 되는 클래스를 보여 줍니다.는 CacheDependency 클래스입니다.The following code example shows a class that inherits from the CacheDependency class. 공용 메서드를 만듭니다 ResetDependency를 사용 하는 SetUtcLastModified 종속성 수정 된 시간을 변경 하는 방법 및 호출을 NotifyDependencyChanged 메서드.It creates a public method, ResetDependency, that uses the SetUtcLastModified method to change the time at which the dependency was modified, and then calls the NotifyDependencyChanged method.

' Declare the class.
Public Class CustomCacheDependency 
   Inherits CacheDependency

     ' Constructor with no arguments 
     ' provided by CacheDependency class.
     Public Sub New()
     End Sub
     ' Declare a Boolean field named disposedValue.
     ' This will be used by Disposed property.
     Private disposedValue As Boolean                
     ' Create accessors for the Disposed property.
     Public Property Disposed As Boolean
           Return disposedValue
       End Get
       Set (ByVal value As Boolean)
           disposedValue = value
       End Set
     End Property
     ' Create a public method that sets the latest
     ' changed time of the CustomCacheDependency
     ' and notifies the underlying CacheDependency that the 
     ' dependency has changed, even though the HasChanged
     ' property is false.
     Public Sub ResetDependency()
        If Me.HasChanged = False              
           NotifyDependencyChanged(Me, EventArgs.Empty)
        End If
     End Sub
     ' Overrides the DependencyDispose method to set the
     ' Disposed proerty to true. This method automatically
     ' notifies the underlying CacheDependency object to 
     ' release any resources associated with this class. 
     Protected Overrides Sub DependencyDispose()
        Disposed = True
     End Sub
 End Class


파생 되는 모든 클래스는 CacheDependency 클래스가이 메서드를 구현 해야 합니다.Any class that derives from the CacheDependency class must implement this method.

파생 하는 경우는 CacheDependency 모든 메서드나 재정의 하지 않은 속성의 기본 기능을 사용 하면 클래스입니다.When you derive from the CacheDependency class, you use the base functionality of any method or property that you have not overridden. 파생된 클래스의 인스턴스를 만들면 파일, 캐시 키, 데이터베이스 테이블 또는 캐시 된 항목에 따라 달라 집니다 확인 하려는 다른 임의의 개체를 나타냅니다.When you create an instance of the derived class, it represents the files, cache keys, database tables, or other arbitrary objects that you want to make a cached item dependent upon. 종속성 항목 변경 될 때이 메서드는의 기본 기능을 알립니다를 CacheDependency 클래스 항목을 변경 있도록 값을 HasChangedUtcLastModified 속성만 업데이트할 수 있습니다.When a dependency item changes, this method notifies the base functionality of the CacheDependency class that the item has changed, so that the values of the HasChanged and UtcLastModified properties can be updated.

적용 대상

추가 정보