Domanda

I'm sure there's something I'm missing here, but a lot of Googling hasn't uncovered it for me. The situation is like this:

We created a custom workflow designer that allows end users to build workflow definitions from various custom activities we define (Review, Submit, Notify, etc). These definitions (Xaml) get saved off to a Db and used to create workflow instances for long running processes in our system. The users can set properties on each of them (e.g. Review has a property argument: AllowedRoles). The problem is, I'm not able to pass those properties on to nested activities.

For example:

Review has an internal activity 'WriteStatus' that needs access to the 'AllowedRoles' property on Review. If 'AllowedRoles' is defined as a Property, WriteStatus can't "see" it to assign it's value. I can change it from a Property to an InArgument, but then I'm not able to map values to and from the property in the designer (these properties should be part of the definition, and not associated with any specific context).

Has anyone faced this issue or have advice on how I could approach the problem differently?

Thanks in advance!

Royce

È stato utile?

Soluzione

I was able to get around the property vs InOurArgument problem by converting the XAML activities to code. This allowed me to set the properties on activities in code, and then pass them to inner activities inline. There may be a better way, but it's working out well so far.

public sealed class Test : Activity
{
    public string Stuff { get; set; } // CLR Property

    public Test()
    {
        Implementation = () => new WriteLine {Text = Stuff};
    }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top