CodeActivity CodeActivity CodeActivity CodeActivity Class

定义

一种抽象类,用于创建具有强制行为(该行为是使用 Execute(CodeActivityContext) 方法定义的,利用该方法可以访问变量以及参数解析和扩展)的自定义活动。An abstract class for creating a custom activity with imperative behavior defined with the Execute(CodeActivityContext) method, which gives access to variable and argument resolution and extensions.

public ref class CodeActivity abstract : System::Activities::Activity
public abstract class CodeActivity : System.Activities.Activity
type CodeActivity = class
    inherit Activity
Public MustInherit Class CodeActivity
Inherits Activity
继承
CodeActivityCodeActivityCodeActivityCodeActivity
派生

示例

下面的代码示例演示如何实现派生自 CodeActivity 的活动。The following example shows how to implement a CodeActivity-derived activity.

public sealed class MessageBox : CodeActivity
{
    public InArgument<string> Text{ get; set; }

    protected override void Execute(CodeActivityContext context)
    {
        System.Windows.Forms.MessageBox.Show(this.Text.Get(context));
    }
}

构造函数

CodeActivity() CodeActivity() CodeActivity() CodeActivity()

在派生类中实现时,创建派生类的实例。When implemented in a derived class, creates an instance of the derived class.

属性

CacheId CacheId CacheId CacheId

获取缓存的标识符,该标识符在工作流定义的作用域内是唯一的。Gets the identifier of the cache that is unique within the scope of the workflow definition.

(Inherited from Activity)
Constraints Constraints Constraints Constraints

获取可配置的 Constraint 活动的集合,用于为 Activity 提供验证。Gets a collection of Constraint activities that can be configured to provide validation for the Activity.

(Inherited from Activity)
DisplayName DisplayName DisplayName DisplayName

获取或设置用于调试、验证、异常处理和跟踪的可选友好名称。Gets or sets an optional friendly name that is used for debugging, validation, exception handling, and tracking.

(Inherited from Activity)
Id Id Id Id

获取一个标识符,该标识符在工作流定义的作用域内是唯一的。Gets an identifier that is unique in the scope of the workflow definition.

(Inherited from Activity)
Implementation Implementation Implementation Implementation

不支持。Not supported.

ImplementationVersion ImplementationVersion ImplementationVersion ImplementationVersion

获取或设置活动的实现版本。Gets or sets the implementation version of the activity.

方法

CacheMetadata(ActivityMetadata) CacheMetadata(ActivityMetadata) CacheMetadata(ActivityMetadata) CacheMetadata(ActivityMetadata)

未实现。Not implemented. 请改用 CacheMetadata(CodeActivityMetadata)Use CacheMetadata(CodeActivityMetadata) instead.

CacheMetadata(CodeActivityMetadata) CacheMetadata(CodeActivityMetadata) CacheMetadata(CodeActivityMetadata) CacheMetadata(CodeActivityMetadata)

创建并验证活动的自变量、变量、子活动和活动委托的说明。Creates and validates a description of the activity's arguments, variables, child activities, and activity delegates.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Execute(CodeActivityContext) Execute(CodeActivityContext) Execute(CodeActivityContext) Execute(CodeActivityContext)

在派生类中实现时,执行该活动。When implemented in a derived class, performs the execution of the activity.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
OnCreateDynamicUpdateMap(UpdateMapMetadata, Activity) OnCreateDynamicUpdateMap(UpdateMapMetadata, Activity) OnCreateDynamicUpdateMap(UpdateMapMetadata, Activity) OnCreateDynamicUpdateMap(UpdateMapMetadata, Activity)

为动态更新创建映射时,将引发事件。Raises an event when creating a map for the dynamic update.

ShouldSerializeDisplayName() ShouldSerializeDisplayName() ShouldSerializeDisplayName() ShouldSerializeDisplayName()

指示是否应序列化 DisplayName 属性。Indicates whether the DisplayName property should be serialized.

(Inherited from Activity)
ToString() ToString() ToString() ToString()

返回包含 StringIdDisplayNameActivityReturns a String that contains the Id and DisplayName of the Activity.

(Inherited from Activity)

适用于