Workflow to Host Data Transfer


Today I was asked about transferring data between the workflow and the host application. Because workflow instances run in a different CPU thread to the host application data transfer is an important consideration. In WF Beta 1 you added parameters to the workflow in the workflow designer.


In WF Beta 2 we still have parameters, but they are defined directly in the workflow class file in code now. Any property on the workflow class can be a parameter. You can also use events implemented in the HandleExternalEvent and CallExternalMethod activities or you can use a custom event activity.


Both of these methods of data transfer are shown in Lab 1 of the Workflow hands on labs for WF Beta 2 which you can get here.

Comments (4)
  1. Chris AUld says:

    Also worth noting that because events from DataTransferServices may be queued on the way into the runtime they need to be serializable- usually just a simple case of implementing ISerializable.

  2. Sander Duivestein says:

    I don’t quite get the differences. When should I use which method?

    I am currently working on a ASP.NET form which kicks off a workflow. What should I use?

    1. Should I start the workflow by setting some parameters (which I received from the form)

    2. Should I start the workflow by raising an event?

    I have seen several samples using one of the above methods, but what is the preferred method?

  3. Paul Andrew says:

    Hi Sander,

    I’d suggest you choose one that works and go with that. I don’t have any data to choose one or the other.

    Cheers,

    Paul

  4. Sander Duivestein says:

    Paul,

    thanks for the answer. I will use the parameters, more readable for other developers.

    Greetings

Comments are closed.

Skip to main content