NativeActivity.CacheMetadata 方法

定義

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

多載

CacheMetadata(ActivityMetadata)

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

CacheMetadata(NativeActivityMetadata)

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

備註

自訂活動作者可以在活動的 CacheMetadata 覆寫中提供驗證邏輯。Custom activity authors can provide validation logic in an activity's CacheMetadata override. CacheMetadata 擲回的任何例外狀況都不會被視為驗證錯誤。Any exceptions that are thrown from CacheMetadata are not treated as validation errors. 這些例外狀況會從 Validate 的呼叫中逸出,而且必須由呼叫端處理。These exceptions will escape from the call to Validate and must be handled by the caller.

CacheMetadata(ActivityMetadata)

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

protected:
 override void CacheMetadata(System::Activities::ActivityMetadata metadata);
protected override sealed void CacheMetadata (System.Activities.ActivityMetadata metadata);
override this.CacheMetadata : System.Activities.ActivityMetadata -> unit
Protected Overrides NotOverridable Sub CacheMetadata (metadata As ActivityMetadata)

參數

metadata
ActivityMetadata

未實作。Not implemented.

備註

自訂活動作者可以在活動的 CacheMetadata 覆寫中提供驗證邏輯。Custom activity authors can provide validation logic in an activity's CacheMetadata override. CacheMetadata 擲回的任何例外狀況都不會被視為驗證錯誤。Any exceptions that are thrown from CacheMetadata are not treated as validation errors. 這些例外狀況會從 Validate 的呼叫中逸出,而且必須由呼叫端處理。These exceptions will escape from the call to Validate and must be handled by the caller.

CacheMetadata(NativeActivityMetadata)

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

protected:
 virtual void CacheMetadata(System::Activities::NativeActivityMetadata metadata);
protected virtual void CacheMetadata (System.Activities.NativeActivityMetadata metadata);
override this.CacheMetadata : System.Activities.NativeActivityMetadata -> unit
Protected Overridable Sub CacheMetadata (metadata As NativeActivityMetadata)

參數

metadata
NativeActivityMetadata

封裝活動引數、變數、子活動和活動委派的活動中繼資料。The activity's metadata that encapsulates the activity's arguments, variables, child activities, and activity delegates.

範例

下列程式碼範例將示範如何在繼承自 NativeActivity<TResult> 的類別中使用 CacheMetadata。The following code sample demonstrates using CacheMetadata in a class that inherits from NativeActivity<TResult>. 這個範例來自于使用原生活動的自訂複合範例。This example is from the Custom Composite using Native Activity sample.

protected override void CacheMetadata(NativeActivityMetadata metadata)
{
    //call base.CacheMetadata to add the Activities and Variables to this activity's metadata
    base.CacheMetadata(metadata);
    //add the private implementation variable: currentIndex 
    metadata.AddImplementationVariable(this.currentIndex);
}                   

備註

工作流程執行階段會使用 CacheMetadata 的預設實作,以確保工作流程的正確結構以及管理執行階段關聯性和存留期規則。The workflow runtime uses the default implementation of CacheMetadata to ensure correct construction of a workflow as well as to manage run-time relationships and lifetime rules. 的預設執行會CacheMetadata使用類型的TypeDescriptor來檢查活動類型的公用成員。The default implementation of CacheMetadata examines the public members of the activity type using the type's TypeDescriptor. 這些公用成員的類型Argument為、 Variableienumerable<變數 >Activityienumerable<活動 >或。 ActivityDelegateThese public members are of type Argument, Variable, IEnumerable<Variable>, Activity, IEnumerable<Activity>, or ActivityDelegate. 您可以覆寫這個方法, 以自訂活動執行時間描述的建立, 並提供自訂驗證邏輯。You can override this method to customize the building of the activity's run-time description and to provide custom validation logic. CacheMetadata 擲回的任何例外狀況都不會被視為驗證錯誤。Any exceptions that are thrown from CacheMetadata are not treated as validation errors. 這些例外狀況會從 Validate 的呼叫中逸出,而且必須由呼叫端處理。These exceptions will escape from the call to Validate and must be handled by the caller.

適用於