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...

[691 byte] By [AlexeyLavnikov] at [2007-12-21]
# 1

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.

JonFlanders at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

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?

AlexeyLavnikov at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3
Alexey - Activity serialization isn't really possible without the ActivitySurrogateSelector added.
JonFlanders at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4

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...

AlexeyLavnikov at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5

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

JoelWest at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified