ActivityValidator 클래스

정의

주의

The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*

모든 활동 유효성 검사기 구성 요소의 기본 클래스인 DependencyObjectValidator의 파생 클래스입니다.

public ref class ActivityValidator : System::Workflow::ComponentModel::Compiler::DependencyObjectValidator
public class ActivityValidator : System.Workflow.ComponentModel.Compiler.DependencyObjectValidator
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public class ActivityValidator : System.Workflow.ComponentModel.Compiler.DependencyObjectValidator
type ActivityValidator = class
    inherit DependencyObjectValidator
[<System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>]
type ActivityValidator = class
    inherit DependencyObjectValidator
Public Class ActivityValidator
Inherits DependencyObjectValidator
상속
파생
특성

예제

다음 예제에서는 사용자 지정 활동에 사용된 전체 ActivityValidator를 보여 줍니다. 사용자 지정 활동은 ConsoleWriteLineActivity 형식의 단일 종속성 속성 이름 Msg를 포함하는 String 활동입니다. 유효성 검사기에서 Msg 속성이 설정되어 있는지 확인합니다. 설정되지 않은 경우 Validate 메서드가 ActivityValidator에서 호출되면 컴파일러에 오류가 표시되고, 컴파일이 실패합니다.

class ConsoleWriteLineActivityValidator : ActivityValidator
{
    public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
    {
        // Invoke the base class method implementation to
        // perform default validation.
        ValidationErrorCollection errors = base.Validate(manager, obj);

        // Make sure there is an activity instance.
        ConsoleWriteLineActivity crw = obj as ConsoleWriteLineActivity;
        if (crw == null)
        {
            throw new InvalidOperationException();
        }

        // If the activity has no parent then this validation
        // is occurring during the compilation of the activity
        // and not during the hosting or creation of an
        // activity instance.
        if (crw.Parent == null)
        {
            // Can skip the rest of the validation because
            // it deals with the hosting and the creation
            // of the activity.
            return errors;
        }

        // Msg is required. Add a validation error if there is no
        // Msg specified or Msg is not bound to another property.
        if (string.IsNullOrEmpty(crw.Msg) &&
            crw.GetBinding(ConsoleWriteLineActivity.MsgProperty) == null)
        {
            errors.Add(new ValidationError("Msg is required", 100, false, "Msg"));
        }

        return errors;
    }
}
Class ConsoleWriteLineActivityValidator
    Inherits ActivityValidator

    Public Overrides Function Validate( _
        ByVal manager As System.Workflow.ComponentModel.Compiler.ValidationManager, _
        ByVal obj As Object) As System.Workflow.ComponentModel.Compiler.ValidationErrorCollection

        'Invoke the base class method implementation to
        'perform default validation.
        Dim errors As ValidationErrorCollection = MyBase.Validate(manager, obj)

        'Make sure there is an activity instance.
        Dim crw As ConsoleWriteLineActivity = CType(obj, ConsoleWriteLineActivity)
        If crw Is Nothing Then
            Throw New InvalidOperationException()
        End If

        'If the activity has no parent then this validation
        'is occurring during the compilation of the activity
        'and not during the hosting or creation of an
        'activity instance.
        If crw.Parent Is Nothing Then
            'Can skip the rest of the validation because
            'it deals with the hosting and the creation
            'of the activity.
            Return errors
        End If

        'Msg is required. Add a validation error if there is no
        'Msg specified or Msg is not bound to another property.
        If String.IsNullOrEmpty(crw.Msg) And _
            crw.GetBinding(ConsoleWriteLineActivity.MsgProperty) Is Nothing Then

            errors.Add(New ValidationError("Msg is required", 100, False, "Msg"))

        End If

        Return errors
    End Function
End Class

설명

참고

이 자료에서는 더 이상 사용되지 않는 형식과 네임스페이스에 대해 설명합니다. 자세한 내용은 Deprecated Types in Windows Workflow Foundation 4.5(Windows Workflow Foundation 4.5에서 사용되지 않는 형식)를 참조하세요.

생성자

ActivityValidator()

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

메서드

Equals(Object)

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

(다음에서 상속됨 Object)
GetFullPropertyName(ValidationManager)

전체 속성 이름을 추출할 도우미 메서드입니다.

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

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

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

현재 인스턴스의 Type을 가져옵니다.

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

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

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

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
Validate(ValidationManager, Object)

지정된 활동이 유효한지 확인합니다.

ValidateActivityChange(Activity, ActivityChangeAction)

파생 클래스에서 재정의되는 경우 추가 또는 제거되는 지정된 Activity에 따라 변경 내용의 유효성을 검사합니다. 이 함수는 동적 업데이트 중에 워크플로의 변경 내용을 적용하는 동안 호출됩니다.

(다음에서 상속됨 Validator)
ValidateProperties(ValidationManager, Object)

특정 개체 속성의 유효성을 자동으로 검사하는 도우미 메서드입니다.

(다음에서 상속됨 Validator)
ValidateProperty(PropertyInfo, Object, Object, ValidationManager)

속성에 대해 유효성 검사를 수행하고 해당 유효성 검사 결과가 포함된 ValidationErrorCollection을 반환합니다.

(다음에서 상속됨 Validator)

적용 대상