Windows Workflow Foundation 3
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
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
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
Thank you very much!
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?
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
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?
Anybody?
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
Related Links
Error in my WorkFlow (Response.Redirect)
Approving Multiple Records in one go..
Dynamic Update
The Executing event of all my SetStateActivity objects dont fire
Design guidance needed for WWF application
Custom pub/sub service for WF message correlation
Is there any event get fired when I changed the content in the workflow designer?
Subscription handler threw System.FormatException
How can I designate string[] field as returnValue for ReceiveActivity?
is the "workflows in memory" performance counter failing to be reset?
Creating a workflow dynamically
writing non-persistance data to Oracle from a workflow app
Is Workflow Foundation a good fit for multiple workflow processes
The workflow failed validation
Can SQL compact edition be used for persistence and tracking storage?
Invoking multiple web service using InvokeWebServiceActivity combined with transaction