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 클래스에는 속성에 예상 범위 또는 패턴 내에 있는 값이 포함되어 있는지 확인하는 사용자 지정된 유효성 검사 조건이 포함될 수도 있습니다.

적용 대상