WCF Workflow Service application xamlx file - no code behind?? No ability to add code activity? RRS feed

  • Question

  • I am writing a WF 4.0 proof of concept application for a possible workflow solution. I've worked with WF 3.0 and 3.5 extensively and have been excited to dive into 4.0. However, I feel like I am trying to drive a motocycle like a car. WF 3.5 -> 4.0 seems like a total paradigm shift.

    I have a simple WCF workflow as a service application. This generates a xamlx file for me. When I load it up in WCF test client it come up fine and works as expected - cool so far!

    My ReceiveRequest takes a custom object ("MyObject") generated from linq-to-sql classes decorated with the datacontract and datamember attributes thanks to the unidirectional serialization property on the datacontact of the dbml file. In the content of the ReceiveRequest I have added an object variable of type MyObject. This works fine. The real pickle is that I need a way for MyObject to reference its workflow. In 3.0/3.5 I simply added a GUID column on my table WorkflowInstanceGUID and when my workflow and object were created, they could refer to each other. Now I am totally stuck because I can't find a way to get that InstanceID from the workflow designer.

    Older 4.0 forum posts say to use the codeactivity and use the context of the code activity to retreive the workflow instance GUID. GREAT I'd love to do that but the code activity no longer shows up in the designer! I think because there's no code behind anymore for xamlx?!?

    How are people relating their workflow instances back to their own objects in 4.0? Is there a best practice I'm missing?

    How can I get access to that workflow instance? I can see that the GUIDS are being persisted to my InstanceStore. I'd just use an invokemethod activity to retrieve the GUID but how when I have no context?

    Any help is surely appreciated!!! thank you!!

    Monday, June 27, 2011 11:43 PM


All replies

  • Hi, you are right, there is no code behind for xamlx. I think what you want to know is how to do correlation between your service and your client, right? This artical has clear description with screenshot:


    Hope this helps.



    This posting is provided "AS IS" and confers no rights or warranties.
    • Marked as answer by wf_kathy Tuesday, June 28, 2011 5:26 PM
    Tuesday, June 28, 2011 6:13 AM
  • Thank you Anders! That helped tremendously!!! I have correlation working now between workflow activities.
    Tuesday, June 28, 2011 5:27 PM