TableNotEnabledForNotificationException 클래스

정의

SqlCacheDependency 클래스를 변경 알림이 활성화되어 있지 않은 데이터베이스 테이블에 대해 사용하는 경우에 throw되는 예외입니다.

public ref class TableNotEnabledForNotificationException sealed : SystemException
[System.Serializable]
public sealed class TableNotEnabledForNotificationException : SystemException
[<System.Serializable>]
type TableNotEnabledForNotificationException = class
    inherit SystemException
Public NotInheritable Class TableNotEnabledForNotificationException
Inherits SystemException
상속
TableNotEnabledForNotificationException
특성

예제

다음 코드 예제에서는 만들려고 시도 SqlCacheDependency 개체 및 항목을 추가 합니다 Cache 에 대 한 종속성을 사용 하 여는 SqlCacheDependency 개체입니다. SQL Server 데이터베이스 테이블 종속성 알림에 사용 하지 않는 경우는 TableNotEnabledForNotificationException throw 되 고 호출 하 여 처리를 SqlCacheDependencyAdmin.EnableTableForNotifications 메서드.

public void Page_Load(object Src, EventArgs E) 
{ 
    // Declare the SqlCacheDependency instance, SqlDep. 
    SqlCacheDependency SqlDep = null; 
    
    // Check the Cache for the SqlSource key. 
    // If it isn't there, create it with a dependency 
    // on a SQL Server table using the SqlCacheDependency class. 
    if (Cache["SqlSource"] == null) { 
        
        // Because of possible exceptions thrown when this 
        // code runs, use Try...Catch...Finally syntax. 
        try { 
            // Instantiate SqlDep using the SqlCacheDependency constructor. 
            SqlDep = new SqlCacheDependency("Northwind", "Categories"); 
        } 
        
        // Handle the DatabaseNotEnabledForNotificationException with 
        // a call to the SqlCacheDependencyAdmin.EnableNotifications method. 
        catch (DatabaseNotEnabledForNotificationException exDBDis) { 
            try { 
                SqlCacheDependencyAdmin.EnableNotifications("Northwind"); 
            } 
            
            // If the database does not have permissions set for creating tables, 
            // the UnauthorizedAccessException is thrown. Handle it by redirecting 
            // to an error page. 
            catch (UnauthorizedAccessException exPerm) { 
                Response.Redirect(".\\ErrorPage.htm"); 
            } 
        } 
        
        // Handle the TableNotEnabledForNotificationException with 
        // a call to the SqlCacheDependencyAdmin.EnableTableForNotifications method. 
        catch (TableNotEnabledForNotificationException exTabDis) { 
            try { 
                SqlCacheDependencyAdmin.EnableTableForNotifications("Northwind", "Categories"); 
            } 
            
            // If a SqlException is thrown, redirect to an error page. 
            catch (SqlException exc) { 
                Response.Redirect(".\\ErrorPage.htm"); 
            } 
        } 
        
        // If all the other code is successful, add MySource to the Cache 
        // with a dependency on SqlDep. If the Categories table changes, 
        // MySource will be removed from the Cache. Then generate a message 
        // that the data is newly created and added to the cache. 
        finally { 
            Cache.Insert("SqlSource", Source1, SqlDep); 
            CacheMsg.Text = "The data object was created explicitly."; 
            
        } 
    } 
    
    else { 
        CacheMsg.Text = "The data was retrieved from the Cache."; 
    } 
} 
Sub Page_Load(Src As Object, E As EventArgs)
   ' Declare the SqlCacheDependency instance, SqlDep.
   Dim SqlDep As SqlCacheDependency

   ' Check the Cache for the SqlSource key.
   ' If it isn't there, create it with a dependency
   ' on a SQL Server table using the SqlCacheDependency class.
   If Cache("SqlSource") Is Nothing

      ' Because of possible exceptions thrown when this
      ' code runs, use Try...Catch...Finally syntax.
      Try
         ' Instantiate SqlDep using the SqlCacheDependency constructor.
         SqlDep = New SqlCacheDependency("Northwind", "Categories")

      ' Handle the DatabaseNotEnabledForNotificationException with
      ' a call to the SqlCacheDependencyAdmin.EnableNotifications method.
      Catch exDBDis As DatabaseNotEnabledForNotificationException
         Try
            SqlCacheDependencyAdmin.EnableNotifications("Northwind")

         ' If the database does not have permissions set for creating tables,
         ' the UnauthorizedAccessException is thrown. Handle it by redirecting
         ' to an error page.
         Catch exPerm As UnauthorizedAccessException
             Response.Redirect(".\ErrorPage.htm")
         End Try

      ' Handle the TableNotEnabledForNotificationException with
            ' a call to the SqlCacheDependencyAdmin.EnableTableForNotifications method.
      Catch exTabDis As TableNotEnabledForNotificationException
         Try
            SqlCacheDependencyAdmin.EnableTableForNotifications( _
             "Northwind", "Categories")

         ' If a SqlException is thrown, redirect to an error page.
         Catch exc As SqlException
             Response.Redirect(".\ErrorPage.htm")
         End Try

      ' If all the other code is successful, add MySource to the Cache
      ' with a dependency on SqlDep. If the Categories table changes,
      ' MySource will be removed from the Cache. Then generate a message
            ' that the data is newly created and added to the cache.
      Finally
         Cache.Insert("SqlSource", Source1, SqlDep)
            CacheMsg.Text = "The data object was created explicitly."

      End Try

    Else
       CacheMsg.Text = "The data was retrieved from the Cache."
    End If
End Sub

생성자

TableNotEnabledForNotificationException()

TableNotEnabledForNotificationException 클래스의 새 인스턴스를 초기화합니다.

TableNotEnabledForNotificationException(String)

지정된 오류 메시지를 사용하여 TableNotEnabledForNotificationException 클래스의 새 인스턴스를 초기화합니다.

TableNotEnabledForNotificationException(String, Exception)

지정된 오류 메시지와 해당 예외의 원인인 내부 예외에 대한 참조를 사용하여 TableNotEnabledForNotificationException 클래스의 새 인스턴스를 초기화합니다.

속성

Data

예외에 대한 사용자 정의 정보를 추가로 제공하는 키/값 쌍 컬렉션을 가져옵니다.

(다음에서 상속됨 Exception)
HelpLink

이 예외와 연결된 도움말 파일에 대한 링크를 가져오거나 설정합니다.

(다음에서 상속됨 Exception)
HResult

특정 예외에 할당된 코드화된 숫자 값인 HRESULT를 가져오거나 설정합니다.

(다음에서 상속됨 Exception)
InnerException

현재 예외를 발생시킨 Exception 인스턴스를 가져옵니다.

(다음에서 상속됨 Exception)
Message

현재 예외를 설명하는 메시지를 가져옵니다.

(다음에서 상속됨 Exception)
Source

오류를 발생시키는 애플리케이션 또는 개체의 이름을 가져오거나 설정합니다.

(다음에서 상속됨 Exception)
StackTrace

호출 스택의 직접 실행 프레임 문자열 표현을 가져옵니다.

(다음에서 상속됨 Exception)
TargetSite

현재 예외를 throw하는 메서드를 가져옵니다.

(다음에서 상속됨 Exception)

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetBaseException()

파생 클래스에서 재정의된 경우 하나 이상의 후속 예외의 근본 원인이 되는 Exception 을 반환합니다.

(다음에서 상속됨 Exception)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetObjectData(SerializationInfo, StreamingContext)

파생 클래스에서 재정의된 경우 예외에 관한 정보를 SerializationInfo 에 설정합니다.

(다음에서 상속됨 Exception)
GetType()

현재 인스턴스의 런타임 형식을 가져옵니다.

(다음에서 상속됨 Exception)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 예외에 대한 문자열 표현을 만들고 반환합니다.

(다음에서 상속됨 Exception)

이벤트

SerializeObjectState
사용되지 않습니다.

예외에 대한 serialize된 데이터가 들어 있는 예외 상태 개체가 만들어지도록 예외가 serialize될 때 발생합니다.

(다음에서 상속됨 Exception)

적용 대상