Share via


CacheDependency.DependencyDispose 메서드

정의

CacheDependency 클래스 및 CacheDependency에서 파생되는 클래스에서 사용되는 리소스를 해제합니다.

protected:
 virtual void DependencyDispose();
protected virtual void DependencyDispose ();
abstract member DependencyDispose : unit -> unit
override this.DependencyDispose : unit -> unit
Protected Overridable Sub DependencyDispose ()

예제

다음 코드 예제에서는 클래스에서 CacheDependency 상속 하 고 메서드를 재정의 하는 클래스를 DependencyDispose 보여 줍니다. 이 메서드가 호출되면 이름이 인 Disposed true사용자 지정 부울 속성을 설정합니다.

' 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
       Get
           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              
           SetUtcLastModified(DateTime.MinValue)
           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 정리하기 위해 이 메서드를 구현하려면 클래스에서 파생되는 모든 클래스가 필요합니다.

적용 대상

추가 정보