Пример #1
0
        protected override void Execute(NativeActivityContext context)
        {
            object            objectToValidate        = _toValidate.Get <object>(context);
            ValidationContext objectToValidateContext = _toValidateContext.Get <ValidationContext>(context);

            if (objectToValidate == null)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.CannotValidateNullObject(typeof(Constraint).Name, this.DisplayName)));
            }

            if (objectToValidateContext == null)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.ValidationContextCannotBeNull(typeof(Constraint).Name, this.DisplayName)));
            }

            List <ValidationError> validationErrorList = new List <ValidationError>(1);

            context.Properties.Add(ValidationErrorListPropertyName, validationErrorList);

            _violationList.Set(context, validationErrorList);

            OnExecute(context, objectToValidate, objectToValidateContext);
        }