简体   繁体   中英

workflow passing out values between activities

I have a CodeActivity GetEstimatedArrivalTime that gets a datetime and returns it as an out argument.

In the designer view, how can I take this value input it into the sequence diagram?

public sealed class CodeActivityGetEVA : CodeActivity
{
    public InArgument<int> EventID { get; set; }
    public OutArgument<DateTime> EVA {get;set;}

    protected override void Execute(CodeActivityContext context)
    {
        EVA.Set(context, DateTime.Now);
    }

Initialize a variable at sequence level (lets call it "EstimatedArrivalTimeVar") and attach it to CodeActivityGetEVA 's EVA out argument. From then on you can use EstimatedArrivalTimeVar with the value assigned to it.

Note that you can use a CodeActivity with a TResult as an out argument already available:

public sealed class CodeActivityGetEVA : CodeActivity<DateTime>
{
    public InArgument<int> EventID { get; set; }

    protected override DateTime Execute(CodeActivityContext context)
    {
        return DateTime.Now;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM