Windows Workflow Foundation 3
WF custom persistence once again
I don't want to save my workflows zipped in a blob field in one table like default SqlWorkflowPersistenceService does. It is not transparent and flexible approach, saved data contains class type information, making workflow evolution almost impossible. I would be a happy WF programmer, If someone explains me how to load/save workflow instances in different tables depending on the workflow class name, layout workflow properties in different fields, so I'd be able to make SQL-queries, and globally update my workflow definition using just new a new WF assembly and sql change script... Or somehow simulate this behavior using persistence & tracking service...
Alexey - Activity serialization isn't really possible without the ActivitySurrogateSelector added.
Alexey, Unfortunately schematized instance state (which is what we call what you're trying to do) is not supported in V1. The recommended approach for saving piece of instance state in a queryable format is to use the WF tracking functionality. Thanks, Joel West MS SDE in WF runtime and hosting This posting is provided "AS IS" with no warranties, and confers no rights
Alexey -how you store the persisted data isn't going to matter very much if you use the Activity.Load method - since that will end up using binary serialization. It is much more important what type your process is going to load when you deserialized. So changing a workflow type would have more to do with changing the underlying type in the CLR type system. Be forwarned though that doing so can have bad consequences if you were to add a type that could be loaded, or otherwise change the type so that the formatter could deserialized it.
I just noticed, that I may pass my own IFormatter object in Activity.Load... The question is what internal workflow information do I need to save to load this workflow correctly later?
Alexey - Activity serialization isn't really possible without the ActivitySurrogateSelector added.
What kind of data is actually saved in this blob? I'm thinking about this. Maybe this is possible. When runtime asks my persistence service to load a workflow: 1) Using stored procedure I check several tables for this GUID to determine what class of the workflow it is. 2) I create a fresh instance of this workflow class using new() operator. 3) I need somehow to save/restore private members of the workflow. I can define some IWorkflowPersist interface with Load/Save methods, and all my workflows will implement it to load/save private members. 4) I do something like workflow.CurrentState = persisted state, workflow.Timers = persisted timers. 5) return workflow as a result. I need only help with task #4...
Alexey, Unfortunately schematized instance state (which is what we call what you're trying to do) is not supported in V1. The recommended approach for saving piece of instance state in a queryable format is to use the WF tracking functionality. Thanks, Joel West MS SDE in WF runtime and hosting This posting is provided "AS IS" with no warranties, and confers no rights
Related Links
Bind workflow property to a read-only activity property
Developing an application for a service support provider.
WorkflowRuntime.CreateWorkflow Performance
Access sequential workflow dependency property from custom activity
Access to workflow queues from external processes
Persiste in a custom activity
Workflow re-activates on Final State when using OnWorkflowItemChanged Event
Windows WorkFlow Foundation: Cannot add a new state in between two existing states.
Within VS2008, can't drill down into a workflow without checking it out
SQLTrackingService tracks incorrect WorkflowInstanceEvent order?
XAML Workflows, Property Bindings and Conditions sample
Tracking query timeouts
Insert activity during PreFilterProperties
Passing data from Activity to Activity in XAML Workflows
Problem with x:Class and CreateWorkflow
Activity property resets back to default inside while activity