简体   繁体   English

工作流在活动之间传递价值

[英]workflow passing out values between activities

I have a CodeActivity GetEstimatedArrivalTime that gets a datetime and returns it as an out argument. 我有一个CodeActivity GetEstimatedArrivalTime,它获取一个日期时间并将其作为out参数返回。

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. 在序列级别初始化变量(将其称为“ EstimatedArrivalTimeVar”),并将其附加到CodeActivityGetEVAEVA out参数。 From then on you can use EstimatedArrivalTimeVar with the value assigned to it. 从那时起,您可以将EstimatedArrivalTimeVar与为其分配的值一起使用。

Note that you can use a CodeActivity with a TResult as an out argument already available: 请注意,可以将带有TResult的CodeActivity用作已经可用的out参数:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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