LinqDataSourceValidationException.InnerExceptions 속성

정의

새 데이터 또는 수정된 데이터의 유효성을 검사하는 중에 발생한 하나 이상의 예외를 가져옵니다.

public:
 property System::Collections::Generic::IDictionary<System::String ^, Exception ^> ^ InnerExceptions { System::Collections::Generic::IDictionary<System::String ^, Exception ^> ^ get(); };
public System.Collections.Generic.IDictionary<string,Exception> InnerExceptions { get; }
member this.InnerExceptions : System.Collections.Generic.IDictionary<string, Exception>
Public ReadOnly Property InnerExceptions As IDictionary(Of String, Exception)

속성 값

예외를 포함하는 컬렉션입니다.

구현

예제

다음 예제에서는 이벤트 처리기는 Updating 이벤트입니다. 사용 하 여 유효성 검사 예외 메시지를 표시 하는 Label 제어 합니다.

Protected Sub LinqDataSource_Updating(ByVal sender As Object, _  
        ByVal e As LinqDataSourceUpdateEventArgs)  
    If (e.Exception IsNot Nothing) Then  
        For Each innerException As KeyValuePair(Of String, Exception) _  
                In e.Exception.InnerExceptions  
          Label1.Text &= innerException.Key & ": " & _   
                  innerException.Value.Message & "<br />"  
        Next  
        e.ExceptionHandled = True  
    End If  
End Sub  
protected void LinqDataSource_Updating(object sender,   
        LinqDataSourceUpdateEventArgs e)   
{  
    if (e.Exception != null)  
    {  
        foreach (KeyValuePair<string, Exception> innerException in   
            e.Exception.InnerExceptions)  
        {  
            Label1.Text += innerException.Key + ": " +   
                innerException.Message + "<br />";  
        }  
        e.ExceptionHandled = true;  
    }  
}  

설명

InnerExceptions 업데이트 하기 전에 데이터 유효성 검사 중에 throw 된 모든 유효성 검사 예외를 포함 하는 컬렉션, 삽입 또는 삭제 작업입니다. 값 속성의 형식과 일치 하지 않는 경우 유효성 검사 예외가 발생할 수 있습니다. 예를 들어, 숫자가 아닌 문자를 사용 하 여 정수 속성을 업데이트 하려고 하면 유효성 검사 예외가 throw 됩니다. LINQ to SQL 클래스 속성에서는 예상된 범위 또는 패턴 내에 있는 값에 포함 되도록 하는 사용자 지정된 유효성 검사 조건을 포함할 수도 있습니다.

적용 대상