예제 #1
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection errors   = base.Validate(manager, obj);
            SuspendActivity           activity = obj as SuspendActivity;

            if (activity == null)
            {
                throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(SuspendActivity).FullName }), "obj");
            }
            for (CompositeActivity activity2 = activity.Parent; activity2 != null; activity2 = activity2.Parent)
            {
                if (activity2.SupportsTransaction)
                {
                    errors.Add(new ValidationError(SR.GetString("Error_SuspendInAtomicScope"), 0x525));
                    return(errors);
                }
            }
            return(errors);
        }
예제 #2
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection validationErrors = base.Validate(manager, obj);

            SuspendActivity suspend = obj as SuspendActivity;

            if (suspend == null)
            {
                throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(SuspendActivity).FullName), "obj");
            }

            CompositeActivity parent = suspend.Parent;

            while (parent != null)
            {
                if (parent.SupportsTransaction)
                {
                    validationErrors.Add(new ValidationError(SR.GetString(SR.Error_SuspendInAtomicScope), ErrorNumbers.Error_SuspendInAtomicScope));
                    break;
                }
                parent = parent.Parent;
            }
            return(validationErrors);
        }