CorrelationScope 類別

定義

針對子傳訊活動提供隱含的 CorrelationHandle 管理。Provides implicit CorrelationHandle management for child messaging activities.

public ref class CorrelationScope : System::Activities::NativeActivity
public class CorrelationScope : System.Activities.NativeActivity
type CorrelationScope = class
    inherit NativeActivity
Public Class CorrelationScope
Inherits NativeActivity
繼承
CorrelationScope

範例

下列範例將示範如何建立 CorrelationScopeThe following example shows how to create a CorrelationScope. 這個範例會建立SequenceCorrelationScope加入 (在其他活動中)。This example creates a Sequence and adds a CorrelationScope (among other activities). CorrelationScope 包含由 SequenceSend 活動組成的 ReceiveReplyThe CorrelationScope contains a Sequence that is composed of a Send and ReceiveReply activity.

return new Sequence
{
    Variables = { po, customer },
    Activities =
    {                    
        new Assign<PurchaseOrder> 
        {
            To = po,
            Value = new InArgument<PurchaseOrder>( (e) => new PurchaseOrder() { PartName = "Widget", Quantity = 150 } )
        },
        new Assign<Customer>
        {
            To = customer,
            Value = new InArgument<Customer>( (e) => new Customer() { Id = 12345678, Name = "John Smith" } )
        },
        new WriteLine { Text = new InArgument<string>( (e) => string.Format("Submitting new PurchaseOrder for {0} {1}s", po.Get(e).Quantity, po.Get(e).PartName) ) },
        new CorrelationScope
        {
            Body = new Sequence
            { 
                Activities = 
                {
                    submitPO,
                    new ReceiveReply
                    {
                        Request = submitPO,
                        Content = ReceiveContent.Create(new OutArgument<int>( (e) => po.Get(e).Id ))
                    }
                }
            }
        },                    
        new WriteLine { Text = new InArgument<string>( (e) => string.Format("Received ID for new PO: {0}", po.Get(e).Id) ) },
        new Assign<int> { To = new OutArgument<int>( (e) => po.Get(e).Quantity ), Value = 250 },
        new WriteLine { Text = "Updated PO with new quantity: 250.  Resubmitting updated PurchaseOrder based on POId." },
        new Send
        {
            Endpoint = clientEndpoint,
            ServiceContractName = Constants.POContractName,
            OperationName = Constants.UpdatePOName,
            Content = SendContent.Create(new InArgument<PurchaseOrder>(po))
        },           
        new Assign<int> 
        { 
            To = new OutArgument<int>( (e) => po.Get(e).CustomerId ), 
            Value = new InArgument<int>( (e) => customer.Get(e).Id )
        },
        new WriteLine { Text = "Updating customer data based on CustomerId." },
        new Send
        {
            Endpoint = clientEndpoint,
            ServiceContractName = Constants.POContractName,
            OperationName = Constants.AddCustomerInfoName,
            Content = SendContent.Create(new InArgument<PurchaseOrder>(po))
        },                    
        new Send
        {
            Endpoint = clientEndpoint,
            ServiceContractName = Constants.POContractName,
            OperationName = Constants.UpdateCustomerName,
            Content = SendContent.Create(new InArgument<Customer>(customer))
        },
        new WriteLine { Text = "Client completed." }
    }
};

備註

CorrelationScope 活動會維持隱含的 CorrelationHandle (僅針對子活動顯示)。The CorrelationScope activity maintains an implicit CorrelationHandle that is only visible to child activities. 當使用者設定 CorrelatesWith 屬性時,這個屬性會用來做為 CorrelationScope 隱含控制代碼。When the CorrelatesWith property is set by the user, it will be used as the CorrelationScope implicit handle. 若是巢狀 CorrelationScope,內部範圍的子系無法存取外部範圍的隱含控制代碼。In the case of nested CorrelationScope, children of the inner scope cannot access implicit handle of the outer scope.

建構函式

CorrelationScope()

初始化 CorrelationScope 類別的新執行個體。Initializes a new instance of the CorrelationScope class.

屬性

Body

取得或設定活動的執行邏輯。Gets or sets the activity's execution logic.

CacheId

取得工作流程定義範圍內的唯一快取識別碼。Gets the identifier of the cache that is unique within the scope of the workflow definition.

(繼承來源 Activity)
CanInduceIdle

取得或設定值,這個值指出此活動是否會造成工作流程變為閒置。Gets or sets a value that indicates whether the activity can cause the workflow to become idle.

(繼承來源 NativeActivity)
Constraints

取得 Constraint 活動的集合,這些活動可以設定為提供 Activity 的驗證。Gets a collection of Constraint activities that can be configured to provide validation for the Activity.

(繼承來源 Activity)
CorrelatesWith

取得或設定子傳訊活動所用的 CorrelationHandleGets or sets the CorrelationHandle used by the child messaging activities.

DisplayName

取得或設定選擇性的易記名稱,這個名稱會用於偵錯、驗證、例外狀況處理及追蹤。Gets or sets an optional friendly name that is used for debugging, validation, exception handling, and tracking.

(繼承來源 Activity)
Id

取得工作流程定義範圍內的唯一識別碼。Gets an identifier that is unique in the scope of the workflow definition.

(繼承來源 Activity)
Implementation

活動的執行邏輯。The execution logic of the activity.

(繼承來源 NativeActivity)
ImplementationVersion

取得或設定活動的實作版本。Gets or sets the implementation version of the activity.

(繼承來源 NativeActivity)

方法

Abort(NativeActivityAbortContext)

在衍生類別中實作時,會採取動作以回應中止的活動。When implemented in a derived class, takes actions in response to the activity being aborted.

(繼承來源 NativeActivity)
CacheMetadata(ActivityMetadata)

未實作。Not implemented. 請改用 CacheMetadata(NativeActivityMetadata) 方法。Use the CacheMetadata(NativeActivityMetadata) method instead.

(繼承來源 NativeActivity)
CacheMetadata(NativeActivityMetadata)

建置並驗證活動之引數、變數、子活動和活動委派的描述。Builds and validates a description of the activity's arguments, variables, child activities, and activity delegates.

Cancel(NativeActivityContext)

在衍生類別中實作時,執行邏輯以便在非失誤性的狀況下及早完成活動。When implemented in a derived class, runs logic to cause graceful early completion of the activity.

(繼承來源 NativeActivity)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
Execute(NativeActivityContext)

由工作流程執行階段呼叫以執行 CorrelationScope 活動。Called by the workflow runtime to execute the CorrelationScope activity.

GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata, Activity)

建立動態更新的對應時引發事件。Raises an event when creating a map for the dynamic update.

(繼承來源 NativeActivity)
OnCreateDynamicUpdateMap(UpdateMapMetadata, Activity)

建立動態更新的對應時引發事件。Raises an event when creating a map for the dynamic update.

(繼承來源 NativeActivity)
ShouldSerializeCorrelatesWith()

指出是否應序列化 CorrelatesWith 屬性。Indicates whether the CorrelatesWith property should be serialized.

ShouldSerializeDisplayName()

指出是否應序列化 DisplayName 屬性。Indicates whether the DisplayName property should be serialized.

(繼承來源 Activity)
ToString()

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

(繼承來源 Activity)
UpdateInstance(NativeActivityUpdateContext)

更新 NativeActivity 的執行個體。Updates the instance of NativeActivity.

(繼承來源 NativeActivity)

適用於