Overview
I've been playing around a bit with the idea of integrating Windows Workflow Foundation into custom web server controls. I've had some success but also hit something of a wall. If you have any experience with any of these issues, I'd love to hear from you.
Context
I've started with the following hypothesis:
In my experience, developers often make mistakes developing custom controls therefore it is beneficial for controls to be modelled rather than 'coded' and Windows Workflow Foundation is a perfect tool for the job.
In practice
Using a workflow to take the place of aspects of the code is straightforward. I started by providing multiple workflows, each run synchronously to handle a distinct control event. This worked well, but suffered in that each workflow was separated and the code ran synchronously. I desired a better solution.
Next, I updated the code to use the default scheduling service, redeveloped the server control to use a single workflow and created a communication service to handle event passing to the workflow. I also added a HandleExternalEvent activity to the workflow to catch the event.
All looked good, until I threw the event. The event attempted to pass the web server control to the workflow but the control was not marked as Serializable and was also not derived from MarshallByRefObject. This meant that the event could not be raised and ultimately killed this solution.
I'm a bit surprised that you can't marshall web controls across process boundaries. This has implications for interactions with any separated service, not just WWF.
Has anyone else had this issue? Any solutions? It is not practical to create a custom marshalling object for every web control type.
Still, it was good experience to use WWF and a successful attempt at integrating WWF activities into a control's life-cycle.
Versions
Metadata
- Categories: Windows Workflow Foundation, Software Development, ASP.NET
- Additional keywords: ExternalDataEventArgs, ExternalDataExchangeService, DefaultWorkflowSchedulerService, ManualWorkflowSchedulerService
- Technorati Tags:
.NET,
ASP.NET,
software development,
Windows Workflow Foundation,
WF,
marshalling