WF: workflow constructor: InArgument parameter list added dynamically: how to get the value when executing a workflow

I created a workflow designer that allows you to enter a list of email addresses. Each email in the list should be InArgument (Of String), so they can be individually edited / added using variables.

In my activity, I have a property that is declared like this:

Public Property [To] As ObservableCollection(Of InArgument(Of String))

My designer is connected and correctly fills this collection.

However, at runtime, I do not know how to get the runtime value for each added InArgument parameter.

When we execute the workflow and iterate for each InArgument parameter added to the list, I tried to get the value as shown below, but it fails:

For Each toAddress As InArgument(Of String) In Me.To.ToList()
            Dim emailToAddress As String = toAddress.Get(_Context)          
Next

, , "The argument of type '<type>' cannot be used. Make sure that it is declared on an activity", type - ...

, , , havent , , , :

The_Property_Name.Get(_Context)

- ? , . ?

0
1

, ! , , - , CacheMetadata() . .

:

   Protected Overrides Sub CacheMetadata(ByVal metadata As CodeActivityMetadata)
        MyBase.CacheMetadata(metadata)

        Dim i As Integer = 0
        For Each item As InArgument(Of String) In Me.To
            Dim runTimeArg As RuntimeArgument = New RuntimeArgument("TO" & i.ToString(), item.ArgumentType, item.Direction, False)
            metadata.Bind(item, runTimeArg)
            metadata.AddArgument(runTimeArg)
            i = i + 1
        Next

    End Sub

,

   For Each item As InArgument(Of String) In Me.To
            Dim email As String = _Context.GetValue(item)
        Next
0

All Articles