ValidationErrorCollection ValidationErrorCollection ValidationErrorCollection ValidationErrorCollection Constructors

정의

오버로드

ValidationErrorCollection() ValidationErrorCollection() ValidationErrorCollection()

ValidationErrorCollection 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the ValidationErrorCollection class.

ValidationErrorCollection(IEnumerable<ValidationError>) ValidationErrorCollection(IEnumerable<ValidationError>) ValidationErrorCollection(IEnumerable<ValidationError>) ValidationErrorCollection(IEnumerable<ValidationError>)

형식 ValidationErrorCollectionIEnumerable 컬렉션에서 ValidationError 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the ValidationErrorCollection class from an IEnumerable collection of type ValidationError

ValidationErrorCollection(ValidationErrorCollection) ValidationErrorCollection(ValidationErrorCollection) ValidationErrorCollection(ValidationErrorCollection) ValidationErrorCollection(ValidationErrorCollection)

ValidationErrorCollection를 사용하여 ValidationErrorCollection 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the ValidationErrorCollection class by using a ValidationErrorCollection.

설명

다음 예제에서는 사용자 지정 유효성 검사 과정의 일환으로 유효성 검사 오류 컬렉션을 만들고 조작하는 방법을 보여 줍니다.The following example shows how to create and manipulate a validation error collection as part of a custom validation routine.

이 코드 예제에서는 보낼 전자 메일 SDK 샘플의 일부 이며 SendMailActivity.cs 파일에 있습니다.This code example is part of the Send Email SDK sample and is from the SendMailActivity.cs file. 자세한 내용은 Send Mail Activity합니다.For more information, see Send Mail Activity.

public class SendEmailValidator : System.Workflow.ComponentModel.Compiler.ActivityValidator
{
    // Define private constants for the Validation Errors 
    private const int InvalidToAddress = 1;
    private const int InvalidFromAddress = 2;
    private const int InvalidSMTPPort = 3;

    //customizing the default activity validation
    public override ValidationErrorCollection ValidateProperties(ValidationManager manager, object obj)
    {

        // Create a new collection for storing the validation errors
        ValidationErrorCollection validationErrors = base.ValidateProperties(manager, obj);


        SendEmailActivity activity = obj as SendEmailActivity;
        if (activity != null)
        {
            // Validate the Email and SMTP Properties
            this.ValidateEmailProperties(validationErrors, activity);
            this.ValidateSMTPProperties(validationErrors, activity);
        }
        return validationErrors;
    }

Public Class SendEmailValidator
    Inherits System.Workflow.ComponentModel.Compiler.ActivityValidator

    ' Define private constants for the Validation Errors 
    Private Const InvalidToAddress As Integer = 1
    Private Const InvalidFromAddress As Integer = 2
    Private Const InvalidSMTPPort As Integer = 3

    ' customizing the default activity validation
    Public Overrides Function ValidateProperties(ByVal manager As ValidationManager, ByVal obj As Object) As ValidationErrorCollection

        ' Create a new collection for storing the validation errors
        Dim validationErrors As New ValidationErrorCollection()

        Dim activity As SendEmailActivity = TryCast(obj, SendEmailActivity)

        If activity IsNot Nothing Then

            ' Validate the Email and SMTP Properties
            Me.ValidateEmailProperties(validationErrors, activity)
            Me.ValidateSMTPProperties(validationErrors, activity)

            ' Raise an exception if we have ValidationErrors
            If validationErrors.HasErrors Then

                Dim validationErrorsMessage As String = String.Empty

                For Each validationError As ValidationError In validationErrors
                    validationErrorsMessage += _
                        String.Format("Validation Error:  Number 0} - '1}' \n", _
                        validationError.ErrorNumber, validationError.ErrorText)
                Next

                ' Throw a new exception with the validation errors.
                Throw New InvalidOperationException(validationErrorsMessage)
            End If
        End If
        Return validationErrors
    End Function

ValidationErrorCollection() ValidationErrorCollection() ValidationErrorCollection()

ValidationErrorCollection 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the ValidationErrorCollection class.

public:
 ValidationErrorCollection();
public ValidationErrorCollection ();
Public Sub New ()

예제

다음 예제에서는 사용자 지정 유효성 검사 과정의 일환으로 유효성 검사 오류 컬렉션을 만들고 조작하는 방법을 보여 줍니다.The following example shows how to create and manipulate a validation error collection as part of a custom validation routine.

이 코드 예제에서는 보낼 전자 메일 SDK 샘플의 일부 이며 SendMailActivity.cs 파일에 있습니다.This code example is part of the Send Email SDK sample and is from the SendMailActivity.cs file. 자세한 내용은 Send Mail Activity합니다.For more information, see Send Mail Activity.

public class SendEmailValidator : System.Workflow.ComponentModel.Compiler.ActivityValidator
{
    // Define private constants for the Validation Errors 
    private const int InvalidToAddress = 1;
    private const int InvalidFromAddress = 2;
    private const int InvalidSMTPPort = 3;

    //customizing the default activity validation
    public override ValidationErrorCollection ValidateProperties(ValidationManager manager, object obj)
    {

        // Create a new collection for storing the validation errors
        ValidationErrorCollection validationErrors = base.ValidateProperties(manager, obj);


        SendEmailActivity activity = obj as SendEmailActivity;
        if (activity != null)
        {
            // Validate the Email and SMTP Properties
            this.ValidateEmailProperties(validationErrors, activity);
            this.ValidateSMTPProperties(validationErrors, activity);
        }
        return validationErrors;
    }

Public Class SendEmailValidator
    Inherits System.Workflow.ComponentModel.Compiler.ActivityValidator

    ' Define private constants for the Validation Errors 
    Private Const InvalidToAddress As Integer = 1
    Private Const InvalidFromAddress As Integer = 2
    Private Const InvalidSMTPPort As Integer = 3

    ' customizing the default activity validation
    Public Overrides Function ValidateProperties(ByVal manager As ValidationManager, ByVal obj As Object) As ValidationErrorCollection

        ' Create a new collection for storing the validation errors
        Dim validationErrors As New ValidationErrorCollection()

        Dim activity As SendEmailActivity = TryCast(obj, SendEmailActivity)

        If activity IsNot Nothing Then

            ' Validate the Email and SMTP Properties
            Me.ValidateEmailProperties(validationErrors, activity)
            Me.ValidateSMTPProperties(validationErrors, activity)

            ' Raise an exception if we have ValidationErrors
            If validationErrors.HasErrors Then

                Dim validationErrorsMessage As String = String.Empty

                For Each validationError As ValidationError In validationErrors
                    validationErrorsMessage += _
                        String.Format("Validation Error:  Number 0} - '1}' \n", _
                        validationError.ErrorNumber, validationError.ErrorText)
                Next

                ' Throw a new exception with the validation errors.
                Throw New InvalidOperationException(validationErrorsMessage)
            End If
        End If
        Return validationErrors
    End Function

ValidationErrorCollection(IEnumerable<ValidationError>) ValidationErrorCollection(IEnumerable<ValidationError>) ValidationErrorCollection(IEnumerable<ValidationError>) ValidationErrorCollection(IEnumerable<ValidationError>)

형식 ValidationErrorCollectionIEnumerable 컬렉션에서 ValidationError 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the ValidationErrorCollection class from an IEnumerable collection of type ValidationError

public:
 ValidationErrorCollection(System::Collections::Generic::IEnumerable<System::Workflow::ComponentModel::Compiler::ValidationError ^> ^ value);
public ValidationErrorCollection (System.Collections.Generic.IEnumerable<System.Workflow.ComponentModel.Compiler.ValidationError> value);
new System.Workflow.ComponentModel.Compiler.ValidationErrorCollection : seq<System.Workflow.ComponentModel.Compiler.ValidationError> -> System.Workflow.ComponentModel.Compiler.ValidationErrorCollection
Public Sub New (value As IEnumerable(Of ValidationError))

매개 변수

value
IEnumerable<ValidationError>

형식 IEnumerableValidationError 컬렉션입니다.The IEnumerable collection of type ValidationError

예외

ValidationErrorCollection(ValidationErrorCollection) ValidationErrorCollection(ValidationErrorCollection) ValidationErrorCollection(ValidationErrorCollection) ValidationErrorCollection(ValidationErrorCollection)

ValidationErrorCollection를 사용하여 ValidationErrorCollection 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the ValidationErrorCollection class by using a ValidationErrorCollection.

public:
 ValidationErrorCollection(System::Workflow::ComponentModel::Compiler::ValidationErrorCollection ^ value);
public ValidationErrorCollection (System.Workflow.ComponentModel.Compiler.ValidationErrorCollection value);
new System.Workflow.ComponentModel.Compiler.ValidationErrorCollection : System.Workflow.ComponentModel.Compiler.ValidationErrorCollection -> System.Workflow.ComponentModel.Compiler.ValidationErrorCollection
Public Sub New (value As ValidationErrorCollection)

매개 변수

예제

다음 예제에서는 사용자 지정 유효성 검사 과정의 일환으로 유효성 검사 오류 컬렉션을 만들고 조작하는 방법을 보여 줍니다.The following example shows how to create and manipulate a validation error collection as part of a custom validation routine.

이 코드 예제에서는 보낼 전자 메일 SDK 샘플의 일부 이며 SendMailActivity.cs 파일에 있습니다.This code example is part of the Send Email SDK sample and is from the SendMailActivity.cs file. 자세한 내용은 Send Mail Activity합니다.For more information, see Send Mail Activity.

public class SendEmailValidator : System.Workflow.ComponentModel.Compiler.ActivityValidator
{
    // Define private constants for the Validation Errors 
    private const int InvalidToAddress = 1;
    private const int InvalidFromAddress = 2;
    private const int InvalidSMTPPort = 3;

    //customizing the default activity validation
    public override ValidationErrorCollection ValidateProperties(ValidationManager manager, object obj)
    {

        // Create a new collection for storing the validation errors
        ValidationErrorCollection validationErrors = base.ValidateProperties(manager, obj);


        SendEmailActivity activity = obj as SendEmailActivity;
        if (activity != null)
        {
            // Validate the Email and SMTP Properties
            this.ValidateEmailProperties(validationErrors, activity);
            this.ValidateSMTPProperties(validationErrors, activity);
        }
        return validationErrors;
    }

Public Class SendEmailValidator
    Inherits System.Workflow.ComponentModel.Compiler.ActivityValidator

    ' Define private constants for the Validation Errors 
    Private Const InvalidToAddress As Integer = 1
    Private Const InvalidFromAddress As Integer = 2
    Private Const InvalidSMTPPort As Integer = 3

    ' customizing the default activity validation
    Public Overrides Function ValidateProperties(ByVal manager As ValidationManager, ByVal obj As Object) As ValidationErrorCollection

        ' Create a new collection for storing the validation errors
        Dim validationErrors As New ValidationErrorCollection()

        Dim activity As SendEmailActivity = TryCast(obj, SendEmailActivity)

        If activity IsNot Nothing Then

            ' Validate the Email and SMTP Properties
            Me.ValidateEmailProperties(validationErrors, activity)
            Me.ValidateSMTPProperties(validationErrors, activity)

            ' Raise an exception if we have ValidationErrors
            If validationErrors.HasErrors Then

                Dim validationErrorsMessage As String = String.Empty

                For Each validationError As ValidationError In validationErrors
                    validationErrorsMessage += _
                        String.Format("Validation Error:  Number 0} - '1}' \n", _
                        validationError.ErrorNumber, validationError.ErrorText)
                Next

                ' Throw a new exception with the validation errors.
                Throw New InvalidOperationException(validationErrorsMessage)
            End If
        End If
        Return validationErrors
    End Function

적용 대상