Workflow Persistence & Event Arguments

I'm developing a State Machine workflow that passes parameters through events. The Workflow will have to persist its state in a SQL database. My understanding is that the persistence services will persist the current state of the Workflow (e.g. which state the Workflow is in). The workflow is rather useless without also persisting the parameters passed in the event arguments. Will the Workflow Persistence Services automatically persist the values passed in the event arguments or will I have to manually persist these parameters in the database

Thank you in advance,

--
Sean


Answer this question

Workflow Persistence & Event Arguments

  • Hussein Ahmad

    The parameters that you passed in get assigned to properties. The persistence service binary serializes the workflow instance. As long as the workflow doesn't change the values of the properties that the parameters were assigned to their original value will be persisted.

    Thanks,

    Joel West

    MSFTE - SDE WF runtime and hosting

    This posting is provided "AS IS" with no warranties, and confers no rights


  • TareqFityani

    Hi Senfo,

    No. You should be able to get the tracked data in UserTrackingRecord.UserData. Also, make sure that you are looking at the correct user tracking event. If your profile enables all user events, you will also see state change events. To filter out just your events, use any string value for the key and you can add a profile which allows only events with that particular key.

    Ranjesh


  • DanCR82

    If you are tracking any data using TrackData method, it will be saved as User Events. Here is a code snippet to access User events

    SqlTrackingWorkflowInstance sqlTrackingWorkflowInstance;

    if (sqlTrackingQuery.TryGetWorkflow(workflowInstanceId, out sqlTrackingWorkflowInstance))

    {

    foreach (UserTrackingRecord userTrackingRecord in sqlTrackingWorkflowInstance.UserEvents)

    {

    Console.WriteLine("\nUser Tracking Event : Event Date Time : {0}, Event Data : {1}\n", userTrackingRecord.EventDateTime.ToString(), userTrackingRecord.UserData.ToString());

    Take a look at the sample UserTrackPoints in section
    \Windows Workflow Foundation\Samples\Technologies\Tracking\UserTrackPoints



  • Thomas Skovsende

    It's not obvious to me how to get the User Events back from the SqlTrackingService. I can see all the Workflow and Activity events in the SQL database, but I can't see the User Events. What is the proper way to get these values back

  • Brian MB

    Thank you, SonaliC!

    Using the StateMachine lab #4 as an example, I'm passing the OrderID in the event arguments to the Workflow. I can see EventArgs in the userTrackingRecord, but it's always null. Is there where my arguments should be

  • deadlock07

    Thank you very much!

  • Billeter

    Anybody
  • Workflow Persistence & Event Arguments