CallExternalMethodActivity parameterbinding

I need some help with CallExternalMethodActivity... How do i pass parameters to the external method? Is it done using parameterbinding? Or is it through DependencyProperty? If it is done using parameterbinding, then, how? Lets say, in the below code

IOperations represents the custom interface which will be used by CallExternalMethodActivity and the method name used will be ExecuteOperation. Now, this method takes a parameter of type ICustomParams. CustomParams implements ICustomParams & it will be used in externaldataexcahnge service and it already inherits ExternalDataEventArgs

The question is how do i pass data to this parameter.
[Serializable]
    public class CustomParams : ExternalDataEventArgs, ICustomParams
    {
        Hashtable m_ht;
        ...
    }

    public class COperations : IOperation
    {
        #region IOperation Members

        public event EventHandler<CustomParams> HandleOperation
        {
            add
            {
                InternalOperation += value;
            }
            remove
            {
                InternalOperation -= value;
            }
        }
        public object ExecuteOperation(ICustomParams oParams)
        {
            ....
        }

        public void TriggerEvent(object sender, Params p)
        {
            InternalOperation(sender, p);
        }
        private event EventHandler<CustomParams> InternalOperation;
        
        #endregion
    }

Open in new window

LVL 3
bvRocksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lazyberezovskyCommented:
IOperation operation = new COperations();
ICustomParams params = new CustomParams();
operation.ExecuteOperation(params);

Why you can't do this?
0
bvRocksAuthor Commented:
The question is specific to Windows Workflow foundation's CallExternalMethodActivity usage. The call to ExecuteOperation comes via the WF framework. However the CallExternalMethodActivity activity does not have any method or a way to specify the parameter contents at runtime or compiletime for that matter.

I understand that when we want to use ActivityBind, we need to have a property in the workflow class corresponding to the bind information provided. However since my workdlows are dynamically generated, i dont want to do such a thing.
0
lazyberezovskyCommented:
Ah, I see. Sorry, can't help you with this issue - never used WWF.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Bob LearnedCommented:
First, I am still learning WWF, and I am not a WWF champion, so this might be a work-in-progress.

The CallExternalMethodActivity class has the ParameterBindings property which is a WorkflowParameterBindingCollection type.

I believe that you should find an answer here:

Host Communication Sample  
http://msdn.microsoft.com/en-us/library/ms742138(v=VS.85).aspx


...and, here is a CodeProject article that talks about WWF:

Using Workflow Foundation and Visual Studio 2008 for Testing Automation
http://www.codeproject.com/KB/WF/TestflowsInVS2008.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bvRocksAuthor Commented:
Yes. But the problem as i mentioned in the previous post is, that the parameterbinding requires us to use ActivityBind class which in turn mandates us to use a member variable in the workflow, which is a problem. If we do that, i have to declare a unique member variable in the class for every activity. Alternatively, if i share one membervariable of the class amongst activities, how do i store the parameter information of the external call in each activity?
0
bvRocksAuthor Commented:
The code project link is good. Will revert after going thro the code in depth. Thanks.
0
Bob LearnedCommented:
I believe that the MSDN reference for the CallExternalMethodActivity.ParameterBindings method gives us a clue:

http://msdn.microsoft.com/en-us/library/system.workflow.activities.callexternalmethodactivity.parameterbindings(v=VS.90).aspx

this.createBallotCallExternalMethodActivity.ParameterBindings.Add(workflowparameterbinding1);

It looks like you need to create an instance of a WorkflowParameterBinding, and add it to the ParameterBindings collection.
0
bvRocksAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.