public override ValidationErrorCollection Validate(ValidationManager manager, object obj) { ValidationErrorCollection errors = base.Validate(manager, obj); CancellationHandlerActivity activity = obj as CancellationHandlerActivity; if (activity == null) { throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(CancellationHandlerActivity).FullName }), "obj"); } if (activity.EnabledActivities.Count == 0) { errors.Add(new ValidationError(SR.GetString("Warning_EmptyBehaviourActivity", new object[] { typeof(CancellationHandlerActivity).FullName, activity.QualifiedName }), 0x1a3, true)); } if (activity.AlternateFlowActivities.Count > 0) { errors.Add(new ValidationError(SR.GetString("Error_ModelingConstructsCanNotContainModelingConstructs"), 0x61f)); } return(errors); }
public override ValidationErrorCollection Validate(ValidationManager manager, object obj) { ValidationErrorCollection validationErrors = base.Validate(manager, obj); CancellationHandlerActivity cancellationHandlerActivity = obj as CancellationHandlerActivity; if (cancellationHandlerActivity == null) { throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(CancellationHandlerActivity).FullName), "obj"); } if (cancellationHandlerActivity.EnabledActivities.Count == 0) { validationErrors.Add(new ValidationError(SR.GetString(SR.Warning_EmptyBehaviourActivity, typeof(CancellationHandlerActivity).FullName, cancellationHandlerActivity.QualifiedName), ErrorNumbers.Warning_EmptyBehaviourActivity, true)); } // cancellation handlers can not contain fault handlers, compensation handler and cancellation handler if (((ISupportAlternateFlow)cancellationHandlerActivity).AlternateFlowActivities.Count > 0) { validationErrors.Add(new ValidationError(SR.GetString(SR.Error_ModelingConstructsCanNotContainModelingConstructs), ErrorNumbers.Error_ModelingConstructsCanNotContainModelingConstructs)); } return(validationErrors); }