I have a Workflow 4 activity that can be run on any number of classes that inherit from my base class. So, the activity is, naturally, generic. Similar to the ForEach or AddToCollection activities, my activity requires a type parameter.
My question is: can I create this activity in the designer with XAML? Keep in mind this is a composite activity, so the designer seems to be the best choice.
If I were to create it in code, it would look like this:
public class MyGenericActivity<T> : Activity where T : MyBaseClass
{
//args would go here
public MyGenericActivity()
{
this.Implementation = () => new Sequence
{
Activities = { //... }
};
}
}
While this solution would work, maintenance would most certainly be painful and you don't get any of the "niceties" of the designer, this way.