CacheDependency.SetUtcLastModified(DateTime) 메서드


종속성을 마지막으로 변경한 시간을 표시합니다.Marks the time when a dependency last changed.

 void SetUtcLastModified(DateTime utcLastModified);
protected void SetUtcLastModified (DateTime utcLastModified);
member this.SetUtcLastModified : DateTime -> unit
Protected Sub SetUtcLastModified (utcLastModified As DateTime)

매개 변수


종속성을 마지막으로 변경한 시간입니다.The time when the dependency last changed.


다음 코드 예제에서 상속 되는 클래스를 보여 줍니다.는 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

적용 대상

추가 정보