ActivityValidator Class
.NET Framework 3.0
Derivative of DependencyObjectValidator that is a base class for all activity validator components.
Namespace: System.Workflow.ComponentModel.Compiler
Assembly: System.Workflow.ComponentModel (in system.workflow.componentmodel.dll)
Assembly: System.Workflow.ComponentModel (in system.workflow.componentmodel.dll)
The following example shows a complete ActivityValidator used for a custom activity. The validator enforces a parent child relationship rule in that the custom activity cannot be used as a child activity of the ListenActivity. When this occurs, the compiler will display an error when the Validate method is called on the ActivityValidator and the compilation will fail.
internal sealed class CustomActivityValidator : ActivityValidator { public override ValidationErrorCollection Validate(ValidationManager manager, object obj) { ValidationErrorCollection validationErrors = base.Validate(manager, obj); CustomActivity ca = obj as CustomActivity; if (ca == null) throw new ArgumentException("Activity instance is null", typeof(CustomActivity).FullName); Activity parent = ca.Parent; while (parent != null) { if (parent is ListenActivity) { validationErrors.Add(new ValidationError("Cannot add custom activity to ListenActivity", 1)); break; } parent = parent.Parent; } return validationErrors; } }
System.Object
System.Workflow.ComponentModel.Compiler.Validator
System.Workflow.ComponentModel.Compiler.DependencyObjectValidator
System.Workflow.ComponentModel.Compiler.ActivityValidator
System.Workflow.Activities.CallExternalMethodActivityValidator
System.Workflow.Activities.HandleExternalEventActivityValidator
System.Workflow.ComponentModel.Compiler.CompositeActivityValidator
System.Workflow.ComponentModel.Compiler.Validator
System.Workflow.ComponentModel.Compiler.DependencyObjectValidator
System.Workflow.ComponentModel.Compiler.ActivityValidator
System.Workflow.Activities.CallExternalMethodActivityValidator
System.Workflow.Activities.HandleExternalEventActivityValidator
System.Workflow.ComponentModel.Compiler.CompositeActivityValidator
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: