.networkflowworkflow-foundation-4designerworkflow-rehosting

WF4 - Rehosted Workflow Designer - Can Host expose services/data to Activities at DESIGN time?


I wrote an application that re-hosts the Workflow 4 Designer (System.Activities.Presentation.WorkflowDesigner). Activities are discovered and dynamically loaded into the toolbox so they can be added to diagrams. I am aware of how to expose services to the activities at execution time, but I'm wondering if something similar is possible at design time. Some of my activities have sophisticated property value editors that can launch dialogs as well as do database loads. I would like for my host application to provide my activities with information such as the connection string they should use, etc.

Anybody know if this is possible? I haven't been able to find any information on how to achieve this. Thanks!


Solution

  • You can absolutely do this via the WorkflowDesigner.Context property.

    This property exposes the EditorContext that is available to your ActivityDesigners (and anyone else who can grab ahold of a ModelItem). You can use the Services property to publish your custom services for use during design time.