Esempio n. 1
0
        public void SetOutArgumentAndReturnValue(ActivityContext context, object state, object[] actualParameters)
        {
            for (int index = 0; index < _parameters.Count; index++)
            {
                if (_parameters[index].Direction != ArgumentDirection.In)
                {
                    _parameters[index].Set(context, actualParameters[index]);
                }
            }

            if (_returnObject != null)
            {
                _returnObject.Set(context, state);
            }
        }
Esempio n. 2
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);
        }