Inheriting from SequentialWorkflow

I'm looking into using Windows Workflow Foundation as part of one of our applications. Users will be able to create their own workflows.

 I'd like to be able to require our users to use workflows that meet certain requirements (e.g. have certain inputs). To do this, I was thinking that it would be nice to be able to create a base class that defines the input parameters to the workflow and perhaps some common methods to get at the data. Users would then be required to use this as the base class.

I tried the following:

* Created a Sequential workflow to use as the base (call it "MyBase"). I had to remove "sealed" from the class generated. I put this in one assembly.

* Created a Sequential workflow in another assembly. Made it inherit instead from MyBase.

The designer seemed to work fine, but when I modify the "Parameters" collection it keeps adding in the parameters I added to MyBase.

I know that this probably isn't a supported thing to do (otherwise the classes wouldn't be sealed), but could it be It would be nice if the UI would be "inheritance-aware". It would really be helpful for my application. (My alternative would be to create a wizard that generates a SequentialWorkflow with my extra stuff, but I don't think that's as good of a solution.)

 



Answer this question

Inheriting from SequentialWorkflow

  • Vaish

    Hi Steve,

    This thread may help.

    Regards,
    Paul



  • raviv762

    So, to summarize, it is allowed to subclass off of SequentialWorkflow (I wasn't sure - I know you've sealed the activities classes and don't want people subclassing those), but doing so might require me to customize the designer.

    (Note: the default designer for activities seems to be able to handle when they are subclassed - only the properties from the class you're designing are shown.)

    By the way, in a semi-related question. Why does the SequentialWorkflow input parameters in a different fashion than Activities. That is, there is the Parameters collection for Workflows, but activities have a set of properties. Why not use the same method for both Why don't activities have as input a Parameters collection and instead use DependencyProperties Or perhaps the opposite

    Another way of phrasing this is: why isn't a SequentialWorkflow just a Sequence with a custom designer What is the purpose of IRootActivity (The DynamicUpdateCondition could be moved into a Sequence, I think).

    By making every Sequence a workflow (and vice versa) I think you make the system potentially more powerful. Or, perhaps I don't really understand things well enough to really know. This is just more or less a random thought.

    Steve

     


  • Inheriting from SequentialWorkflow