Esempio n. 1
0
        internal protected override OperationParameterInfoCollection GetParameters(IServiceProvider provider)
        {
            OperationParameterInfoCollection parameters = new OperationParameterInfoCollection();

            MethodInfo methodInfo = this.GetMethodInfo(provider);

            if (methodInfo != null)
            {
                foreach (ParameterInfo parameter in methodInfo.GetParameters())
                {
                    if (parameters[parameter.Name] == null)
                    {
                        parameters.Add(new OperationParameterInfo(parameter));
                    }
                }

                if (methodInfo.ReturnParameter != null && methodInfo.ReturnParameter.ParameterType != typeof(void))
                {
                    if (parameters["(ReturnValue)"] == null)
                    {
                        OperationParameterInfo parameterInfo = new OperationParameterInfo(methodInfo.ReturnParameter);
                        parameterInfo.Name = "(ReturnValue)";
                        parameters.Add(parameterInfo);
                    }
                }
            }

            return(parameters);
        }
Esempio n. 2
0
        protected override void InitializeProperties()
        {
            TypedOperationInfo serviceOperationInfo = this.ServiceOperationInfo;

            if (serviceOperationInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                          new InvalidOperationException(SR2.GetString(SR2.Error_ServiceOperationInfoNotSpecified, this.Name)));
            }

            OperationParameterInfoCollection parameters = null;

            Activity definitionRoot = base.RootActivity.GetValue(Activity.WorkflowDefinitionProperty) as Activity;

            if (definitionRoot != null)
            {
                SendActivity definition = definitionRoot.GetActivityByName(this.QualifiedName, true) as SendActivity;
                if ((definition != null) && definition.UserData.Contains(typeof(OperationParameterInfoCollection)))
                {
                    parameters = definition.UserData[typeof(OperationParameterInfoCollection)] as OperationParameterInfoCollection;
                }
            }

            if (parameters == null)
            {
                parameters = serviceOperationInfo.GetParameters(this.Site);
                this.UserData[typeof(OperationParameterInfoCollection)] = parameters;
            }

            WorkflowParameterBindingCollection parameterBindings = this.ParameterBindings;

            foreach (OperationParameterInfo parameterInfo in parameters)
            {
                if (!parameterBindings.Contains(parameterInfo.Name))
                {
                    parameterBindings.Add(new WorkflowParameterBinding(parameterInfo.Name));
                }
            }

            base.InitializeProperties();
        }