Refactoring data types in persisted workflows RRS feed

  • Question

  • We have an application relying on Windows Workflow Foundation 4.0. We have one workflow which we have several versions of. These workflows are long-lived (about 2 months) and we are running different versions of it concurrently in production. The workflows are persisted using SqlWorkflowInstanceStore.

    These workflows refers to several different data types (business objets/entities), used both as variables and as arguments. 

    We now want to do some refactoring of our code base, and move entities from one assembly/namespace to another assembly/namespace. When we do this, calling WorkflowApplication.Load for all workflow instances (which are still referring to the old assembly/namespace fails with:

    'DynamicActivity': The private implementation of activity '1: DynamicActivity' has the following validation error:   Compiler error(s) encountered processing expression "Users".
    'Users' is not declared. It may be inaccessible due to its protection level.

    This makes some sense to me. As I understand it, SqlWorkflowInstanceStore uses DataContractSerializer to deserialize old instances, and if I move the implementation of one entity to a new namespace this will fail.

    What's the recommended way to solve this? Should we create new entities, let the existing workflows finish running and then ditch the old entities?


    Wednesday, June 5, 2013 11:32 AM